Cascader support Form's disabled

This commit is contained in:
梁灏 2019-09-16 22:00:21 +08:00
parent 0875722286
commit 35d896af03

View file

@ -7,7 +7,7 @@
:element-id="elementId"
ref="input"
:readonly="!filterable"
:disabled="disabled"
:disabled="itemDisabled"
:value="displayInputRender"
@on-change="handleInput"
:size="size"
@ -34,7 +34,7 @@
ref="caspanel"
:prefix-cls="prefixCls"
:data="data"
:disabled="disabled"
:disabled="itemDisabled"
:change-on-select="changeOnSelect"
:trigger="trigger"></Caspanel>
<div :class="[prefixCls + '-dropdown']" v-show="filterable && query !== '' && querySelections.length">
@ -63,13 +63,14 @@
import { oneOf } from '../../utils/assist';
import Emitter from '../../mixins/emitter';
import Locale from '../../mixins/locale';
import mixinsForm from '../../mixins/form';
const prefixCls = 'ivu-cascader';
const selectPrefixCls = 'ivu-select';
export default {
name: 'Cascader',
mixins: [ Emitter, Locale ],
mixins: [ Emitter, Locale, mixinsForm ],
components: { iInput, Drop, Icon, Caspanel },
directives: { clickOutside, TransferDom },
props: {
@ -165,13 +166,13 @@
[`${prefixCls}-show-clear`]: this.showCloseIcon,
[`${prefixCls}-size-${this.size}`]: !!this.size,
[`${prefixCls}-visible`]: this.visible,
[`${prefixCls}-disabled`]: this.disabled,
[`${prefixCls}-disabled`]: this.itemDisabled,
[`${prefixCls}-not-found`]: this.filterable && this.query !== '' && !this.querySelections.length
}
];
},
showCloseIcon () {
return this.currentValue && this.currentValue.length && this.clearable && !this.disabled;
return this.currentValue && this.currentValue.length && this.clearable && !this.itemDisabled;
},
displayRender () {
let label = [];
@ -271,7 +272,7 @@
},
methods: {
clearSelect () {
if (this.disabled) return false;
if (this.itemDisabled) return false;
const oldVal = JSON.stringify(this.currentValue);
this.currentValue = this.selected = this.tmpSelected = [];
this.handleClose();
@ -283,7 +284,7 @@
this.visible = false;
},
toggleOpen () {
if (this.disabled) return false;
if (this.itemDisabled) return false;
if (this.visible) {
if (!this.filterable) this.handleClose();
} else {