2016-11-15 19:17:54 +08:00
|
|
|
|
<template>
|
2017-05-09 15:46:08 +08:00
|
|
|
|
<li :class="classes">
|
|
|
|
|
{{ data.label }}
|
2019-04-10 11:09:45 +08:00
|
|
|
|
<Icon :type="arrowType" :custom="customArrowType" :size="arrowSize" v-if="showArrow" />
|
2018-06-25 19:53:55 +08:00
|
|
|
|
<i v-if="showLoading" class="ivu-icon ivu-icon-ios-loading ivu-load-loop"></i>
|
2017-05-09 15:46:08 +08:00
|
|
|
|
</li>
|
2016-11-15 19:17:54 +08:00
|
|
|
|
</template>
|
|
|
|
|
<script>
|
2019-04-10 11:09:45 +08:00
|
|
|
|
import Icon from '../icon/icon.vue';
|
|
|
|
|
|
2016-11-15 19:17:54 +08:00
|
|
|
|
export default {
|
2017-03-06 17:30:39 +08:00
|
|
|
|
name: 'Casitem',
|
2019-04-10 11:09:45 +08:00
|
|
|
|
components: { Icon },
|
2016-11-15 19:17:54 +08:00
|
|
|
|
props: {
|
|
|
|
|
data: Object,
|
|
|
|
|
prefixCls: String,
|
|
|
|
|
tmpItem: Object
|
|
|
|
|
},
|
|
|
|
|
computed: {
|
|
|
|
|
classes () {
|
|
|
|
|
return [
|
|
|
|
|
`${this.prefixCls}-menu-item`,
|
|
|
|
|
{
|
2016-11-15 23:23:16 +08:00
|
|
|
|
[`${this.prefixCls}-menu-item-active`]: this.tmpItem.value === this.data.value,
|
|
|
|
|
[`${this.prefixCls}-menu-item-disabled`]: this.data.disabled
|
2016-11-15 19:17:54 +08:00
|
|
|
|
}
|
2016-12-25 22:49:42 +08:00
|
|
|
|
];
|
2017-05-09 15:46:08 +08:00
|
|
|
|
},
|
|
|
|
|
showArrow () {
|
|
|
|
|
return (this.data.children && this.data.children.length) || ('loading' in this.data && !this.data.loading);
|
|
|
|
|
},
|
|
|
|
|
showLoading () {
|
|
|
|
|
return 'loading' in this.data && this.data.loading;
|
2019-04-10 11:09:45 +08:00
|
|
|
|
},
|
|
|
|
|
// 3.4.0, global setting customArrow 有值时,arrow 赋值空
|
|
|
|
|
arrowType () {
|
|
|
|
|
let type = 'ios-arrow-forward';
|
|
|
|
|
|
|
|
|
|
if (this.$IVIEW) {
|
|
|
|
|
if (this.$IVIEW.cascader.customItemArrow) {
|
|
|
|
|
type = '';
|
|
|
|
|
} else if (this.$IVIEW.cascader.itemArrow) {
|
|
|
|
|
type = this.$IVIEW.cascader.itemArrow;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return type;
|
|
|
|
|
},
|
|
|
|
|
// 3.4.0, global setting
|
|
|
|
|
customArrowType () {
|
|
|
|
|
let type = '';
|
|
|
|
|
|
|
|
|
|
if (this.$IVIEW) {
|
|
|
|
|
if (this.$IVIEW.cascader.customItemArrow) {
|
|
|
|
|
type = this.$IVIEW.cascader.customItemArrow;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return type;
|
|
|
|
|
},
|
|
|
|
|
// 3.4.0, global setting
|
|
|
|
|
arrowSize () {
|
|
|
|
|
let size = '';
|
|
|
|
|
|
|
|
|
|
if (this.$IVIEW) {
|
|
|
|
|
if (this.$IVIEW.cascader.itemArrowSize) {
|
|
|
|
|
size = this.$IVIEW.cascader.itemArrowSize;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return size;
|
2016-11-15 19:17:54 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
2016-12-25 22:49:42 +08:00
|
|
|
|
};
|
|
|
|
|
</script>
|