uni-oaview 1.1.1 → 1.1.3

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.
@@ -15,8 +15,18 @@
15
15
  <script lang="ts" setup>
16
16
  import { reactive, ref } from 'vue';
17
17
  import { OPEN_CONFIRM_BOX } from '../../constants';
18
+ import { onHide, onShow } from '@dcloudio/uni-app';
19
+
18
20
  const popupRef = ref();
21
+ const isPageAlive = ref(false);
22
+
19
23
  const isShow = ref(false);
24
+ onShow(() => {
25
+ isPageAlive.value = true;
26
+ });
27
+ onHide(() => {
28
+ isPageAlive.value = false;
29
+ });
20
30
  const state = reactive({
21
31
  title: '温馨提示',
22
32
  content: '请输入提醒内容',
@@ -30,6 +40,8 @@
30
40
  popupRef.value.close();
31
41
  };
32
42
  uni.$on(OPEN_CONFIRM_BOX, (params: any) => {
43
+ /** 如果页面非alive状态,则不执行操作 */
44
+ if (!isPageAlive.value) return;
33
45
  isShow.value = true;
34
46
  setTimeout(() => {
35
47
  const { title, content, confirmText, cancelText, callback } = params;
@@ -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;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "uni-oaview",
3
- "version": "1.1.1",
3
+ "version": "1.1.3",
4
4
  "description": "uniapp小程序组件库",
5
5
  "main": "dist/index.esm.js",
6
6
  "typings": "dist/index.d.ts",