mirror of
https://github.com/tusen-ai/naive-ui.git
synced 2025-01-06 12:17:13 +08:00
feat(select-menu): auto pending at first option
This commit is contained in:
parent
64f79eb4a3
commit
f18af716ad
@ -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) {
|
||||
|
Loading…
Reference in New Issue
Block a user