stellar-ui-v2 1.40.31 → 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"],
@@ -1,7 +1,5 @@
1
1
  import Vue from 'vue';
2
- import Vuex from 'vuex';
3
2
 
4
- Vue.use(Vuex);
5
3
  const DEFAULT_KEY = '$steMsgBoxKey';
6
4
  const DEFAULT_CONFIG = {
7
5
  title: '',
@@ -19,54 +17,43 @@ const DEFAULT_CONFIG = {
19
17
  complete: null,
20
18
  };
21
19
 
22
- const store = new Vuex.Store({
23
- state: {},
24
- mutations: {
25
- initializeState(state, key) {
26
- if (!state[key]) {
27
- Vue.set(state, key, {
28
- selector: key,
29
- openBegin: false,
30
- ...DEFAULT_CONFIG,
31
- });
32
- }
33
- },
34
- setState(state, { key, params }) {
35
- Object.assign(state[key], params);
36
- },
37
- resetState(state, key) {
38
- Object.assign(state[key], {
39
- openBegin: false,
40
- });
41
- },
42
- },
43
- });
20
+ const stateMap = Vue.observable({});
44
21
 
45
22
  function useSteMsgBox(key) {
46
23
  key = key ?? DEFAULT_KEY;
47
- store.commit('initializeState', key);
24
+ // 初始化状态
25
+ if (!stateMap[key]) {
26
+ Vue.set(stateMap, key, {
27
+ selector: key,
28
+ openBegin: false,
29
+ ...DEFAULT_CONFIG,
30
+ });
31
+ }
48
32
 
49
33
  return {
50
- showMsgBox(params) {
51
- store.commit('setState', {
52
- key,
53
- params: {
54
- ...DEFAULT_CONFIG,
55
- ...params,
56
- confirm: params.confirm ?? function () {},
57
- cancel: params.cancel ?? function () {},
58
- complete: params.complete ?? function () {},
59
- openBegin: true,
60
- },
34
+ // 显示消息弹框
35
+ showMsgBox(params = {}) {
36
+ Object.assign(stateMap[key], {
37
+ ...DEFAULT_CONFIG,
38
+ ...params,
39
+ confirm: params.confirm ?? function() {},
40
+ cancel: params.cancel ?? function() {},
41
+ complete: params.complete ?? function() {},
42
+ openBegin: true,
61
43
  });
62
44
  },
45
+ // 关闭消息弹框
63
46
  hideMsgBox() {
64
- store.commit('resetState', key);
47
+ Object.assign(stateMap[key], {
48
+ openBegin: false,
49
+ });
65
50
  },
66
- $state: store.state[key],
67
- $store: store,
51
+ // 响应式数据
52
+ $state: stateMap[key],
68
53
  };
69
54
  }
70
55
 
71
56
  export default useSteMsgBox;
72
- export { DEFAULT_KEY };
57
+ export {
58
+ DEFAULT_KEY
59
+ };