mirror of
https://gitee.com/vant-contrib/vant.git
synced 2025-04-06 03:57:59 +08:00
fix(NoticeBar): failed to play when inside a re-opened popup (#8791)
This commit is contained in:
parent
38856e2e1c
commit
c608f15f47
@ -58,9 +58,16 @@ export function PopupMixin(options = {}) {
|
||||
}),
|
||||
],
|
||||
|
||||
provide() {
|
||||
return {
|
||||
vanPopup: this,
|
||||
};
|
||||
},
|
||||
|
||||
props: popupMixinProps,
|
||||
|
||||
data() {
|
||||
this.onReopenCallback = [];
|
||||
return {
|
||||
inited: this.value,
|
||||
};
|
||||
@ -135,6 +142,9 @@ export function PopupMixin(options = {}) {
|
||||
this.opened = true;
|
||||
this.renderOverlay();
|
||||
this.addLock();
|
||||
this.onReopenCallback.forEach((callback) => {
|
||||
callback();
|
||||
});
|
||||
},
|
||||
|
||||
addLock() {
|
||||
@ -220,6 +230,10 @@ export function PopupMixin(options = {}) {
|
||||
updateZIndex(value = 0) {
|
||||
this.$el.style.zIndex = ++context.zIndex + value;
|
||||
},
|
||||
|
||||
onReopen(callback) {
|
||||
this.onReopenCallback.push(callback);
|
||||
},
|
||||
},
|
||||
};
|
||||
}
|
||||
|
@ -14,6 +14,12 @@ export default createComponent({
|
||||
}),
|
||||
],
|
||||
|
||||
inject: {
|
||||
vanPopup: {
|
||||
default: null,
|
||||
},
|
||||
},
|
||||
|
||||
props: {
|
||||
text: String,
|
||||
mode: String,
|
||||
@ -53,6 +59,14 @@ export default createComponent({
|
||||
},
|
||||
},
|
||||
|
||||
created() {
|
||||
if (this.vanPopup) {
|
||||
this.vanPopup.onReopen(() => {
|
||||
this.start();
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
activated() {
|
||||
this.start();
|
||||
},
|
||||
|
Loading…
x
Reference in New Issue
Block a user