uni-oaview 1.1.0 → 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;
@@ -0,0 +1,11 @@
1
+ const prefix = 'oa-ehK3Krfu#$opk^Ug!6Ce!-';
2
+
3
+ /**
4
+ * 打开toast事件名称
5
+ */
6
+ export const OPEN_TOAST = `${prefix}open-toast`;
7
+
8
+ /**
9
+ * 打开确认框事件名称
10
+ */
11
+ export const OPEN_CONFIRM_BOX = `${prefix}open-confirm-box`;
@@ -0,0 +1 @@
1
+ export * from './event-names';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "uni-oaview",
3
- "version": "1.1.0",
3
+ "version": "1.1.2",
4
4
  "description": "uniapp小程序组件库",
5
5
  "main": "dist/index.esm.js",
6
6
  "typings": "dist/index.d.ts",
@@ -10,7 +10,8 @@
10
10
  "components",
11
11
  "src",
12
12
  "imgs",
13
- "style"
13
+ "style",
14
+ "constants"
14
15
  ],
15
16
  "author": "",
16
17
  "license": "ISC",