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