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,
|
props: popupMixinProps,
|
||||||
|
|
||||||
data() {
|
data() {
|
||||||
|
this.onReopenCallback = [];
|
||||||
return {
|
return {
|
||||||
inited: this.value,
|
inited: this.value,
|
||||||
};
|
};
|
||||||
@ -135,6 +142,9 @@ export function PopupMixin(options = {}) {
|
|||||||
this.opened = true;
|
this.opened = true;
|
||||||
this.renderOverlay();
|
this.renderOverlay();
|
||||||
this.addLock();
|
this.addLock();
|
||||||
|
this.onReopenCallback.forEach((callback) => {
|
||||||
|
callback();
|
||||||
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
addLock() {
|
addLock() {
|
||||||
@ -220,6 +230,10 @@ export function PopupMixin(options = {}) {
|
|||||||
updateZIndex(value = 0) {
|
updateZIndex(value = 0) {
|
||||||
this.$el.style.zIndex = ++context.zIndex + value;
|
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: {
|
props: {
|
||||||
text: String,
|
text: String,
|
||||||
mode: String,
|
mode: String,
|
||||||
@ -53,6 +59,14 @@ export default createComponent({
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
|
created() {
|
||||||
|
if (this.vanPopup) {
|
||||||
|
this.vanPopup.onReopen(() => {
|
||||||
|
this.start();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
activated() {
|
activated() {
|
||||||
this.start();
|
this.start();
|
||||||
},
|
},
|
||||||
|
Loading…
x
Reference in New Issue
Block a user