mirror of
https://gitee.com/vant-contrib/vant.git
synced 2025-04-06 03:57:59 +08:00
fix(DropdownMenu): should't close when custom container and get clicked (#5047)
This commit is contained in:
parent
73847ec83e
commit
dbd0951b30
@ -40,6 +40,14 @@ export default createComponent({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
beforeCreate() {
|
||||||
|
const createEmitter = eventName => () => this.$emit(eventName);
|
||||||
|
|
||||||
|
this.onOpen = createEmitter('open');
|
||||||
|
this.onClose = createEmitter('close');
|
||||||
|
this.onOpened = createEmitter('opened');
|
||||||
|
},
|
||||||
|
|
||||||
methods: {
|
methods: {
|
||||||
toggle(show = !this.showPopup, options = {}) {
|
toggle(show = !this.showPopup, options = {}) {
|
||||||
if (show === this.showPopup) {
|
if (show === this.showPopup) {
|
||||||
@ -53,17 +61,15 @@ export default createComponent({
|
|||||||
this.parent.updateOffset();
|
this.parent.updateOffset();
|
||||||
this.showWrapper = true;
|
this.showWrapper = true;
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
onClickWrapper(event) {
|
||||||
|
if (this.getContainer) {
|
||||||
|
event.stopPropagation();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
beforeCreate() {
|
|
||||||
const createEmitter = eventName => () => this.$emit(eventName);
|
|
||||||
|
|
||||||
this.onOpen = createEmitter('open');
|
|
||||||
this.onClose = createEmitter('close');
|
|
||||||
this.onOpened = createEmitter('opened');
|
|
||||||
},
|
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const {
|
const {
|
||||||
zIndex,
|
zIndex,
|
||||||
@ -113,6 +119,7 @@ export default createComponent({
|
|||||||
ref="wrapper"
|
ref="wrapper"
|
||||||
style={style}
|
style={style}
|
||||||
class={bem([direction])}
|
class={bem([direction])}
|
||||||
|
onClick={this.onClickWrapper}
|
||||||
>
|
>
|
||||||
<Popup
|
<Popup
|
||||||
vModel={this.showPopup}
|
vModel={this.showPopup}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user