mirror of
https://gitee.com/vant-contrib/vant.git
synced 2025-04-06 03:57:59 +08:00
chore(DropdownItem): improve v-model
This commit is contained in:
parent
0b208dc04b
commit
d4f26db341
@ -96,16 +96,17 @@ export default createComponent({
|
||||
this.parent.updateOffset();
|
||||
},
|
||||
|
||||
onClosed() {
|
||||
this.showWrapper = false;
|
||||
this.$emit('closed');
|
||||
},
|
||||
|
||||
onClickWrapper(event) {
|
||||
// prevent being identified as clicking outside and closed when using teleport
|
||||
if (this.teleport) {
|
||||
event.stopPropagation();
|
||||
}
|
||||
},
|
||||
|
||||
onTogglePopup(show) {
|
||||
this.showPopup = show;
|
||||
},
|
||||
},
|
||||
|
||||
render() {
|
||||
@ -161,7 +162,7 @@ export default createComponent({
|
||||
onClick={this.onClickWrapper}
|
||||
>
|
||||
<Popup
|
||||
show={this.showPopup}
|
||||
vModel={[this.showPopup, 'show']}
|
||||
overlay={overlay}
|
||||
class={bem('content')}
|
||||
position={direction === 'down' ? 'top' : 'bottom'}
|
||||
@ -172,11 +173,7 @@ export default createComponent({
|
||||
onOpen={this.onOpen}
|
||||
onClose={this.onClose}
|
||||
onOpened={this.onOpened}
|
||||
onClosed={() => {
|
||||
this.showWrapper = false;
|
||||
this.$emit('closed');
|
||||
}}
|
||||
{...{ 'onUpdate:modelValue': this.onTogglePopup }}
|
||||
onClosed={this.onClosed}
|
||||
>
|
||||
{Options}
|
||||
{this.$slots.default?.()}
|
||||
|
Loading…
x
Reference in New Issue
Block a user