mirror of https://github.com/ElemeFE/element
Fix Option 'label' prop
parent
01f6b9da7d
commit
39bf244190
|
@ -6,7 +6,7 @@
|
|||
v-show="queryPassed"
|
||||
:class="{ 'selected': itemSelected, 'is-disabled': disabled, 'hover': parent.hoverIndex === index }">
|
||||
<slot>
|
||||
<span>{{ label }}</span>
|
||||
<span>{{ currentLabel }}</span>
|
||||
</slot>
|
||||
</li>
|
||||
</template>
|
||||
|
@ -40,7 +40,8 @@
|
|||
return {
|
||||
index: -1,
|
||||
queryPassed: true,
|
||||
hitState: false
|
||||
hitState: false,
|
||||
currentLabel: this.label
|
||||
};
|
||||
},
|
||||
|
||||
|
@ -92,7 +93,7 @@
|
|||
},
|
||||
|
||||
queryChange(query) {
|
||||
this.queryPassed = new RegExp(query, 'i').test(this.label);
|
||||
this.queryPassed = new RegExp(query, 'i').test(this.currentLabel);
|
||||
if (!this.queryPassed) {
|
||||
this.parent.filteredOptionsCount--;
|
||||
}
|
||||
|
@ -106,7 +107,7 @@
|
|||
},
|
||||
|
||||
created() {
|
||||
this.label = this.label || ((typeof this.value === 'string' || typeof this.value === 'number') ? this.value : '');
|
||||
this.currentLabel = this.currentLabel || ((typeof this.value === 'string' || typeof this.value === 'number') ? this.value : '');
|
||||
this.parent.options.push(this);
|
||||
this.parent.optionsCount++;
|
||||
this.parent.filteredOptionsCount++;
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
:hit="item.hitState"
|
||||
type="primary"
|
||||
@click.native="deleteTag($event, item)"
|
||||
close-transition>{{ item.label }}</el-tag>
|
||||
close-transition>{{ item.currentLabel }}</el-tag>
|
||||
</transition-group>
|
||||
<input
|
||||
type="text"
|
||||
|
@ -290,7 +290,7 @@
|
|||
this.bottomOverflowBeforeHidden = this.selected.$el.getBoundingClientRect().bottom - this.$refs.popper.$el.getBoundingClientRect().bottom;
|
||||
}
|
||||
if (this.selected && this.selected.value) {
|
||||
this.selectedLabel = this.selected.label;
|
||||
this.selectedLabel = this.selected.currentLabel;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
@ -360,7 +360,7 @@
|
|||
}
|
||||
} else {
|
||||
this.selected = option;
|
||||
this.selectedLabel = option.label;
|
||||
this.selectedLabel = option.currentLabel;
|
||||
this.hoverIndex = option.index;
|
||||
}
|
||||
},
|
||||
|
@ -402,12 +402,12 @@
|
|||
handleOptionSelect(option) {
|
||||
if (!this.multiple) {
|
||||
this.selected = option;
|
||||
this.selectedLabel = option.label;
|
||||
this.selectedLabel = option.currentLabel;
|
||||
this.visible = false;
|
||||
} else {
|
||||
let optionIndex = -1;
|
||||
this.selected.forEach((item, index) => {
|
||||
if (item === option || item.label === option.label) {
|
||||
if (item === option || item.currentLabel === option.currentLabel) {
|
||||
optionIndex = index;
|
||||
}
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue