uni-oaview 1.1.1 → 1.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -14,8 +14,10 @@
|
|
|
14
14
|
import successPath from '../../imgs/toast/success.svg';
|
|
15
15
|
import warningPath from '../../imgs/toast/warning.svg';
|
|
16
16
|
import { OPEN_TOAST } from '../../constants';
|
|
17
|
+
import { onHide, onShow } from '@dcloudio/uni-app';
|
|
17
18
|
const popupRef = ref();
|
|
18
19
|
const isShow = ref(false);
|
|
20
|
+
const isPageAlive = ref(false);
|
|
19
21
|
const state = reactive({
|
|
20
22
|
title: '',
|
|
21
23
|
content: '',
|
|
@@ -27,7 +29,15 @@
|
|
|
27
29
|
const open = () => {
|
|
28
30
|
popupRef.value?.open('center');
|
|
29
31
|
};
|
|
32
|
+
onShow(() => {
|
|
33
|
+
isPageAlive.value = true;
|
|
34
|
+
});
|
|
35
|
+
onHide(() => {
|
|
36
|
+
isPageAlive.value = false;
|
|
37
|
+
});
|
|
30
38
|
uni.$on(OPEN_TOAST, (params: any) => {
|
|
39
|
+
/** 如果页面非alive状态,则不执行操作 */
|
|
40
|
+
if (!isPageAlive.value) return;
|
|
31
41
|
isShow.value = true;
|
|
32
42
|
setTimeout(() => {
|
|
33
43
|
const { title, content, confirmText, type } = params;
|