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();
|
this.parent.updateOffset();
|
||||||
},
|
},
|
||||||
|
|
||||||
|
onClosed() {
|
||||||
|
this.showWrapper = false;
|
||||||
|
this.$emit('closed');
|
||||||
|
},
|
||||||
|
|
||||||
onClickWrapper(event) {
|
onClickWrapper(event) {
|
||||||
// prevent being identified as clicking outside and closed when using teleport
|
// prevent being identified as clicking outside and closed when using teleport
|
||||||
if (this.teleport) {
|
if (this.teleport) {
|
||||||
event.stopPropagation();
|
event.stopPropagation();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
onTogglePopup(show) {
|
|
||||||
this.showPopup = show;
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
@ -161,7 +162,7 @@ export default createComponent({
|
|||||||
onClick={this.onClickWrapper}
|
onClick={this.onClickWrapper}
|
||||||
>
|
>
|
||||||
<Popup
|
<Popup
|
||||||
show={this.showPopup}
|
vModel={[this.showPopup, 'show']}
|
||||||
overlay={overlay}
|
overlay={overlay}
|
||||||
class={bem('content')}
|
class={bem('content')}
|
||||||
position={direction === 'down' ? 'top' : 'bottom'}
|
position={direction === 'down' ? 'top' : 'bottom'}
|
||||||
@ -172,11 +173,7 @@ export default createComponent({
|
|||||||
onOpen={this.onOpen}
|
onOpen={this.onOpen}
|
||||||
onClose={this.onClose}
|
onClose={this.onClose}
|
||||||
onOpened={this.onOpened}
|
onOpened={this.onOpened}
|
||||||
onClosed={() => {
|
onClosed={this.onClosed}
|
||||||
this.showWrapper = false;
|
|
||||||
this.$emit('closed');
|
|
||||||
}}
|
|
||||||
{...{ 'onUpdate:modelValue': this.onTogglePopup }}
|
|
||||||
>
|
>
|
||||||
{Options}
|
{Options}
|
||||||
{this.$slots.default?.()}
|
{this.$slots.default?.()}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user