Select: Option add new prop: tag

This commit is contained in:
梁灏 2019-09-09 10:24:04 +08:00
parent 81395eca7d
commit 616c19f5be
2 changed files with 7 additions and 1 deletions

View file

@ -34,6 +34,10 @@
isFocused: { isFocused: {
type: Boolean, type: Boolean,
default: false default: false
},
// 4.0.0
tag: {
type: [String, Number]
} }
}, },
data () { data () {
@ -67,10 +71,12 @@
this.dispatch('iSelect', 'on-select-selected', { this.dispatch('iSelect', 'on-select-selected', {
value: this.value, value: this.value,
label: this.optionLabel, label: this.optionLabel,
tag: this.tag
}); });
this.$emit('on-select-selected', { this.$emit('on-select-selected', {
value: this.value, value: this.value,
label: this.optionLabel, label: this.optionLabel,
tag: this.tag
}); });
}, },
}, },

View file

@ -9,7 +9,7 @@
class="ivu-tag ivu-tag-checked" class="ivu-tag ivu-tag-checked"
v-for="(item, index) in selectedMultiple" v-for="(item, index) in selectedMultiple"
v-if="maxTagCount === undefined || index < maxTagCount"> v-if="maxTagCount === undefined || index < maxTagCount">
<span class="ivu-tag-text">{{ item.label }}</span> <span class="ivu-tag-text">{{ item.tag !== undefined ? item.tag : item.label }}</span>
<Icon type="ios-close" @click.native.stop="removeTag(item)"></Icon> <Icon type="ios-close" @click.native.stop="removeTag(item)"></Icon>
</div><div class="ivu-tag ivu-tag-checked" v-if="maxTagCount !== undefined && selectedMultiple.length > maxTagCount"> </div><div class="ivu-tag ivu-tag-checked" v-if="maxTagCount !== undefined && selectedMultiple.length > maxTagCount">
<span class="ivu-tag-text ivu-select-max-tag"> <span class="ivu-tag-text ivu-select-max-tag">