feat(select-menu): auto pending at first option

This commit is contained in:
07akioni 2019-12-30 23:12:12 +08:00
parent 64f79eb4a3
commit f18af716ad

View File

@ -144,6 +144,10 @@ export default {
mirror: {
type: Boolean,
default: true
},
autoPendingFirstOption: {
type: Boolean,
defa: false
}
},
data () {
@ -191,8 +195,12 @@ export default {
},
linkedOptions () {
this.$nextTick().then(() => {
this.hideLightBar()
this.pendingOption = null
if (this.autoPendingFirstOption) {
this.setPendingOptionElementValue(this.linkedOptions.firstAvailableOptionValue)
} else {
this.hideLightBar()
this.pendingOption = null
}
})
},
pendingOption (value) {
@ -203,6 +211,11 @@ export default {
}
}
},
mounted () {
if (this.autoPendingFirstOption) {
this.setPendingOptionElementValue(this.linkedOptions.firstAvailableOptionValue)
}
},
methods: {
hideLightBar () {
if (this.$refs.lightBar) {