@we-debug/miniprogram 0.35.0 → 0.37.0

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.
package/CHANGELOG.md CHANGED
@@ -3,6 +3,28 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ # [0.37.0](https://github.com/dlhandsome/we-debug/compare/v0.36.0...v0.37.0) (2024-11-25)
7
+
8
+
9
+ ### Features
10
+
11
+ * 支持动态更新 group ([ff4c1a2](https://github.com/dlhandsome/we-debug/commit/ff4c1a20944b5fa3113383e361271f85062c9a4f))
12
+
13
+
14
+
15
+
16
+
17
+ # [0.36.0](https://github.com/dlhandsome/we-debug/compare/v0.35.0...v0.36.0) (2024-11-25)
18
+
19
+
20
+ ### Features
21
+
22
+ * 添加规则时更新视图 ([f303b29](https://github.com/dlhandsome/we-debug/commit/f303b29a877cb20e6dae21cb3c055b9da560d2a6))
23
+
24
+
25
+
26
+
27
+
6
28
  # [0.35.0](https://github.com/dlhandsome/we-debug/compare/v0.34.1...v0.35.0) (2024-11-13)
7
29
 
8
30
 
@@ -6,6 +6,22 @@ const sys = store.sys.get();
6
6
  const currentGroupCache = Debug.createCache('__wedebug_miniprogram_group_actived_key__', '');
7
7
  const DEFAULT_GROUP = Debug.DEFAULT_GROUP;
8
8
 
9
+ const setGroup = () =>
10
+ store.group.getKeys((next, prev) => {
11
+ if (prev === '全部') {
12
+ return 1;
13
+ }
14
+ if (next === '全部') {
15
+ return -1;
16
+ }
17
+ if (prev === '未分类') {
18
+ return -1;
19
+ }
20
+ if (next === '未分类') {
21
+ return 1;
22
+ }
23
+ });
24
+
9
25
  Component({
10
26
  options: {
11
27
  multipleSlots: true
@@ -51,20 +67,7 @@ Component({
51
67
  },
52
68
  searchStr: '',
53
69
  group: {
54
- keys: store.group.getKeys((next, prev) => {
55
- if (prev === '全部') {
56
- return 1;
57
- }
58
- if (next === '全部') {
59
- return -1;
60
- }
61
- if (prev === '未分类') {
62
- return -1;
63
- }
64
- if (next === '未分类') {
65
- return 1;
66
- }
67
- }),
70
+ keys: setGroup(),
68
71
  actived: currentGroupCache.get() || DEFAULT_GROUP.ALL
69
72
  }
70
73
  },
@@ -72,6 +75,9 @@ Component({
72
75
  setSys() {
73
76
  this.setData({ sys: store.sys.get() });
74
77
  },
78
+ setGroups() {
79
+ return setGroup();
80
+ },
75
81
  setRules() {
76
82
  this.setData({ rules: store.group.get(currentGroupCache.get() || DEFAULT_GROUP.ALL).get() });
77
83
  },
@@ -111,13 +117,28 @@ Component({
111
117
  });
112
118
  // 设置当前分组 key 缓存
113
119
  currentGroupCache.set(group);
120
+ },
121
+ addListeners() {
122
+ store.event.on('rule:update', this.setRules.bind(this));
123
+ store.event.on('badge:update', this.setBadges.bind(this));
124
+ store.event.on('group:update', this.setGroups.bind(this));
125
+ },
126
+ removeListeners() {
127
+ store.event.off('rule:update', this.setRules.bind(this));
128
+ store.event.off('badge:update', this.setBadges.bind(this));
129
+ store.event.off('group:update', this.setGroups.bind(this));
114
130
  }
115
131
  },
116
132
  lifetimes: {
117
133
  attached() {
118
134
  this.setSys();
135
+ this.setGroups();
119
136
  this.setRules();
120
137
  this.setBadges();
138
+ this.addListeners();
139
+ },
140
+ detached() {
141
+ this.removeListeners();
121
142
  }
122
143
  }
123
144
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@we-debug/miniprogram",
3
- "version": "0.35.0",
3
+ "version": "0.37.0",
4
4
  "description": "we-debug miniprogram component",
5
5
  "author": {
6
6
  "name": "dlhandsome"
@@ -26,10 +26,10 @@
26
26
  },
27
27
  "license": "MIT",
28
28
  "dependencies": {
29
- "@we-debug/core": "0.35.0"
29
+ "@we-debug/core": "0.37.0"
30
30
  },
31
31
  "readme": "ERROR: No README data found!",
32
32
  "_id": "@we-debug/core@0.3.5",
33
33
  "_commitid": "6c3f04b",
34
- "gitHead": "96d3e626e4999925356e542098ee60ccf4d41721"
34
+ "gitHead": "cb94171955d848ec1e26ea1ef6e9021fd170d771"
35
35
  }