stellar-ui-v2 1.40.32 → 1.40.33

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.
@@ -12,7 +12,7 @@ npm install ste-vue-inset-loader --save-dev
12
12
  ```
13
13
  "insetLoader": {
14
14
  "config": {
15
- "msgBox": "<root-portal><ste-message-box id='steMessageBox'></ste-message-box></root-portal>"
15
+ "msgBox": "<ste-message-box id='steMessageBox'></ste-message-box>"
16
16
  },
17
17
  // 全局配置
18
18
  "label": ["msgBox"],
@@ -32,13 +32,13 @@ function useSteMsgBox(key) {
32
32
 
33
33
  return {
34
34
  // 显示消息弹框
35
- showMsgBox(params) {
35
+ showMsgBox(params = {}) {
36
36
  Object.assign(stateMap[key], {
37
37
  ...DEFAULT_CONFIG,
38
38
  ...params,
39
- confirm: params.confirm ?? function () {},
40
- cancel: params.cancel ?? function () {},
41
- complete: params.complete ?? function () {},
39
+ confirm: params.confirm ?? function() {},
40
+ cancel: params.cancel ?? function() {},
41
+ complete: params.complete ?? function() {},
42
42
  openBegin: true,
43
43
  });
44
44
  },
@@ -54,4 +54,6 @@ function useSteMsgBox(key) {
54
54
  }
55
55
 
56
56
  export default useSteMsgBox;
57
- export { DEFAULT_KEY };
57
+ export {
58
+ DEFAULT_KEY
59
+ };
@@ -15,7 +15,7 @@ npm install ste-vue-inset-loader --save-dev
15
15
  ```
16
16
  "insetLoader": {
17
17
  "config": {
18
- "toast": "<root-portal><ste-toast id='steToast'></ste-toast></root-portal>"
18
+ "toast": "<ste-toast id='steToast'></ste-toast>"
19
19
  },
20
20
  // 全局配置
21
21
  "label": ["toast"],
@@ -1,67 +1,67 @@
1
- import Vue from 'vue';
2
-
3
- let $state = Vue.observable({
4
- openBegin: false,
5
- title: '',
6
- icon: '',
7
- image: '',
8
- duration: 1500,
9
- mask: false,
10
- success: null,
11
- fail: null,
12
- complete: null,
13
- close: null,
14
- enableCrossPagePrompt: false,
15
- timer: [],
16
- });
17
-
18
- function useSteToast() {
19
- return {
20
- /*打开弹窗*/
21
- showToast(params) {
22
- // 默认持续时间
23
- let defaultDuration = 1500;
24
- // 关闭前面的弹窗
25
- $state.openBegin = false;
26
- // 关闭系统的弹窗
27
- uni.hideToast();
28
- // 提示队列
29
- let time = 0;
30
- if (params.order) {
31
- // 先取上一次存的值 如果为空 则为第一个值
32
- let toastLastParams = uni.getStorageSync('toastLastParams');
33
- // 等待的时间 第一个没有等待时间 后面的都是前面的持续时间的合
34
- if (typeof toastLastParams == 'object') {
35
- time = toastLastParams.time;
36
- }
37
- // 存当前的等待时间 加100ms 以防没有打开中间的提示
38
- params.time = time + (params.duration ?? defaultDuration) + 100;
39
- uni.setStorageSync('toastLastParams', params);
40
- } else {
41
- // 遇到非队列数据 则清空队列时间
42
- uni.removeStorageSync('toastLastParams');
43
- }
44
- let timer = setTimeout(() => {
45
- $state.openBegin = true;
46
- $state.title = params.title ?? '';
47
- $state.icon = params.icon ?? 'success';
48
- $state.image = params.image ?? '';
49
- $state.duration = params.duration ?? defaultDuration;
50
- $state.mask = params.mask ?? false;
51
- $state.success = params.success ?? function () {};
52
- $state.fail = params.fail ?? function () {};
53
- $state.complete = params.complete ?? function () {};
54
- $state.close = params.close ?? function () {};
55
- $state.enableCrossPagePrompt = params.enableCrossPagePrompt ?? false;
56
- }, time);
57
- $state.timer.push(timer);
58
- },
59
- /*关闭弹窗*/
60
- hideToast() {
61
- $state.openBegin = false;
62
- },
63
- /**响应式数据*/
64
- $state,
65
- };
66
- }
67
- export default useSteToast;
1
+ import Vue from 'vue';
2
+
3
+ let $state = Vue.observable({
4
+ openBegin: false,
5
+ title: '',
6
+ icon: '',
7
+ image: '',
8
+ duration: 1500,
9
+ mask: false,
10
+ success: null,
11
+ fail: null,
12
+ complete: null,
13
+ close: null,
14
+ enableCrossPagePrompt: false,
15
+ timer: [],
16
+ });
17
+
18
+ function useSteToast() {
19
+ return {
20
+ /*打开弹窗*/
21
+ showToast(params = {}) {
22
+ // 默认持续时间
23
+ let defaultDuration = 1500;
24
+ // 关闭前面的弹窗
25
+ $state.openBegin = false;
26
+ // 关闭系统的弹窗
27
+ uni.hideToast();
28
+ // 提示队列
29
+ let time = 0;
30
+ if (params.order) {
31
+ // 先取上一次存的值 如果为空 则为第一个值
32
+ let toastLastParams = uni.getStorageSync('toastLastParams');
33
+ // 等待的时间 第一个没有等待时间 后面的都是前面的持续时间的合
34
+ if (typeof toastLastParams == 'object') {
35
+ time = toastLastParams.time;
36
+ }
37
+ // 存当前的等待时间 加100ms 以防没有打开中间的提示
38
+ params.time = time + (params.duration ?? defaultDuration) + 100;
39
+ uni.setStorageSync('toastLastParams', params);
40
+ } else {
41
+ // 遇到非队列数据 则清空队列时间
42
+ uni.removeStorageSync('toastLastParams');
43
+ }
44
+ let timer = setTimeout(() => {
45
+ $state.openBegin = true;
46
+ $state.title = params.title ?? '';
47
+ $state.icon = params.icon ?? 'success';
48
+ $state.image = params.image ?? '';
49
+ $state.duration = params.duration ?? defaultDuration;
50
+ $state.mask = params.mask ?? false;
51
+ $state.success = params.success ?? function() {};
52
+ $state.fail = params.fail ?? function() {};
53
+ $state.complete = params.complete ?? function() {};
54
+ $state.close = params.close ?? function() {};
55
+ $state.enableCrossPagePrompt = params.enableCrossPagePrompt ?? false;
56
+ }, time);
57
+ $state.timer.push(timer);
58
+ },
59
+ /*关闭弹窗*/
60
+ hideToast() {
61
+ $state.openBegin = false;
62
+ },
63
+ /**响应式数据*/
64
+ $state,
65
+ };
66
+ }
67
+ export default useSteToast;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "stellar-ui-v2",
3
- "version": "1.40.32",
3
+ "version": "1.40.33",
4
4
  "description": "StellarUI组件库,支持全量引入和按需引入",
5
5
  "main": "./index.js",
6
6
  "module": "./index.js",