Merge remote-tracking branch 'iview/2.0' into 2.0
This commit is contained in:
commit
ce124aeb57
16 changed files with 246 additions and 207 deletions
|
@ -59,8 +59,8 @@
|
|||
handleTriggerItem (item, fromInit = false, fromUser = false) {
|
||||
if (item.disabled) return;
|
||||
|
||||
const cascader = findComponentUpward(this, 'Cascader');
|
||||
if (item.loading !== undefined && !item.children.length) {
|
||||
const cascader = findComponentUpward(this, 'Cascader');
|
||||
if (cascader && cascader.loadData) {
|
||||
cascader.loadData(item, () => {
|
||||
// todo
|
||||
|
@ -110,6 +110,10 @@
|
|||
fromInit: fromInit
|
||||
});
|
||||
}
|
||||
|
||||
if (cascader) {
|
||||
cascader.$refs.drop.update();
|
||||
}
|
||||
},
|
||||
updateResult (item) {
|
||||
this.result = [this.tmpItem].concat(item);
|
||||
|
|
|
@ -30,6 +30,9 @@
|
|||
@keydown="handleKeydown"
|
||||
@focus="handleFocus"
|
||||
@blur="handleBlur"
|
||||
@compositionstart="handleComposition"
|
||||
@compositionupdate="handleComposition"
|
||||
@compositionend="handleComposition"
|
||||
@input="handleInput"
|
||||
@change="handleChange">
|
||||
<div :class="[prefixCls + '-group-append']" v-if="append" v-show="slotReady"><slot name="append"></slot></div>
|
||||
|
@ -62,6 +65,9 @@
|
|||
@keydown="handleKeydown"
|
||||
@focus="handleFocus"
|
||||
@blur="handleBlur"
|
||||
@compositionstart="handleComposition"
|
||||
@compositionupdate="handleComposition"
|
||||
@compositionend="handleComposition"
|
||||
@input="handleInput">
|
||||
</textarea>
|
||||
</div>
|
||||
|
@ -179,7 +185,8 @@
|
|||
slotReady: false,
|
||||
textareaStyles: {},
|
||||
showPrefix: false,
|
||||
showSuffix: false
|
||||
showSuffix: false,
|
||||
isOnComposition: false
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
|
@ -244,7 +251,18 @@
|
|||
this.dispatch('FormItem', 'on-form-blur', this.currentValue);
|
||||
}
|
||||
},
|
||||
handleComposition(event) {
|
||||
if (event.type === 'compositionstart') {
|
||||
this.isOnComposition = true;
|
||||
}
|
||||
if (event.type === 'compositionend') {
|
||||
this.isOnComposition = false;
|
||||
this.handleInput(event);
|
||||
}
|
||||
},
|
||||
handleInput (event) {
|
||||
if (this.isOnComposition) return;
|
||||
|
||||
let value = event.target.value;
|
||||
if (this.number && value !== '') value = Number.isNaN(Number(value)) ? value : Number(value);
|
||||
this.$emit('input', value);
|
||||
|
|
|
@ -762,21 +762,12 @@
|
|||
},
|
||||
slotOptions(options, old){
|
||||
// #4626,当 Options 的 label 更新时,v-model 的值未更新
|
||||
if (options && options.length && this.values.length && !this.multiple) {
|
||||
this.values = this.values.map(value => {
|
||||
const option = options.find(option => {
|
||||
if (!option.componentOptions) return false;
|
||||
return option.componentOptions.propsData.value === value.value;
|
||||
});
|
||||
|
||||
if(!option) return null;
|
||||
|
||||
const label = getOptionLabel(option);
|
||||
return {
|
||||
value: value.value,
|
||||
label: label
|
||||
};
|
||||
}).filter(Boolean);
|
||||
// remote 下,调用 getInitialValue 有 bug
|
||||
if (!this.remote) {
|
||||
const values = this.getInitialValue();
|
||||
if (this.flatOptions && this.flatOptions.length && values.length && !this.multiple) {
|
||||
this.values = values.map(this.getOptionData).filter(Boolean);
|
||||
}
|
||||
}
|
||||
|
||||
// 当 dropdown 在控件上部显示时,如果选项列表的长度由外部动态变更了,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue