vite-uni-dev-tool 0.0.19 → 0.0.20

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/README.md CHANGED
@@ -197,6 +197,10 @@ optimizeDeps: {
197
197
 
198
198
  ## 更新日志
199
199
 
200
+ ### 0.0.20
201
+
202
+ - 修复 storage 调用异常
203
+
200
204
  ### 0.0.19
201
205
 
202
206
  - 修复 VirtualListPro 向上滚动
@@ -207,13 +207,13 @@ export declare class DevEvent {
207
207
  * @param {string} key
208
208
  * @memberof DevEvent
209
209
  */
210
- removeStorage(key: string): void;
210
+ removeStorage(key: string, local?: boolean): void;
211
211
  /**
212
212
  * 清除缓存
213
213
  *
214
214
  * @memberof DevEvent
215
215
  */
216
- clearStorage(): void;
216
+ clearStorage(local?: boolean): void;
217
217
  /**
218
218
  * 重置 storage 函数
219
219
  *
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../dev/devEvent/index.ts"],"names":[],"mappings":";AAkCA,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAavC,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAE/C;;;;;GAKG;AACH,qBAAa,QAAQ;IACnB,OAAO,CAAC,KAAK,CAAW;IAExB,OAAO,CAAC,QAAQ,CAAW;gBAEf,EAAE,KAAK,EAAE,QAAQ,EAAE,EAAE;QAAE,KAAK,EAAE,QAAQ,CAAC;QAAC,QAAQ,EAAE,QAAQ,CAAA;KAAE;IAMxE;;;;;OAKG;IACG,aAAa;IAkBnB;;;;OAIG;IACH,WAAW,kCAAsC;IAEjD;;;;;OAKG;IACH,aAAa;IAUb;;;;;OAKG;IACH,cAAc;IA0Cd;;;;OAIG;IACH,cAAc;IAQd;;;;OAIG;IACH,iBAAiB;IAQjB;;;;OAIG;IACH,kBAAkB;IAKlB;;;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Aa;IAI/C,kBAAkB,CAAC,SAAS,EAAE,OAAO,CAAC,SAAS,EAAE;IAIjD,aAAa;IAIb,aAAa;IAOb,OAAO,CAAC,IAAI,EAAE,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC;IAehC;;;;;OAKG;IACH,QAAQ,CAAC,IAAI,EAAE,MAAM;IAmDrB;;;;;OAKG;IACH,uBAAuB,CAAC,IAAI,EAAE,OAAO,CAAC,iBAAiB,EAAE;IAKzD;;;;OAIG;IACH,sBAAsB;CAGvB"}
@@ -142,7 +142,7 @@ class Y {
142
142
  h,
143
143
  (e) => {
144
144
  var t;
145
- e.type === u ? this.store.clearConsoleList() : e.type === c ? this.store.clearNetworkList() : e.type === D ? this.store.clearWsList() : e.type === v ? this.store.clearUploadList() : e.type === E ? this.store.clearStorageList() : e.type === g ? (this.store.refreshStore(), this.postMessage()) : e.type === T ? (this.store.removeStorage(e.data.key + ""), this.postMessage()) : e.type === _ ? (this.store.addStorage(e.data), this.postMessage()) : e.type === S ? (this.store.updateStore(e.data), this.postMessage()) : e.type === d ? ((t = e.data) == null ? void 0 : t.type) === "nav" ? this.switchTo(e.data.path ?? "") : this.navigateTo(e.data.path ?? "") : e.type === f ? (e.data.show ? this.showDevToolButton() : this.hideDevToolButton(), this.postMessage()) : e.type === y ? this.restartDevTool() : e.type === m ? this.restartApp() : e.type === L ? this.exportLog(e.data) : e.type === R ? (this.store.updateVuexStore(e.data), this.postMessage()) : e.type === I ? (this.store.updatePiniaStore(e.data), this.postMessage()) : e.type === V ? this.store.clearDevCache() : e.type === C ? this.destroyDevTool() : e.type === A ? this.openDevToolWindow() : e.type === O ? this.closeDevToolWindow() : e.type === M ? this.refreshRouteList() : e.type === w ? this.sendDevToolOption() : e.type === U ? this.uniEventClear() : e.type === P ? this.devRunJS(e.data.code) : e.type === x && this.store.clearCaptureScreenList();
145
+ e.type === u ? this.store.clearConsoleList() : e.type === c ? this.store.clearNetworkList() : e.type === D ? this.store.clearWsList() : e.type === v ? this.store.clearUploadList() : e.type === E ? this.store.clearStorageList(!0) : e.type === g ? (this.store.refreshStore(), this.postMessage()) : e.type === T ? (this.store.removeStorage(e.data.key + "", !0), this.postMessage()) : e.type === _ ? (this.store.addStorage(e.data, !0), this.postMessage()) : e.type === S ? (this.store.updateStore(e.data), this.postMessage()) : e.type === d ? ((t = e.data) == null ? void 0 : t.type) === "nav" ? this.switchTo(e.data.path ?? "") : this.navigateTo(e.data.path ?? "") : e.type === f ? (e.data.show ? this.showDevToolButton() : this.hideDevToolButton(), this.postMessage()) : e.type === y ? this.restartDevTool() : e.type === m ? this.restartApp() : e.type === L ? this.exportLog(e.data) : e.type === R ? (this.store.updateVuexStore(e.data), this.postMessage()) : e.type === I ? (this.store.updatePiniaStore(e.data), this.postMessage()) : e.type === V ? this.store.clearDevCache() : e.type === C ? this.destroyDevTool() : e.type === A ? this.openDevToolWindow() : e.type === O ? this.closeDevToolWindow() : e.type === M ? this.refreshRouteList() : e.type === w ? this.sendDevToolOption() : e.type === U ? this.uniEventClear() : e.type === P ? this.devRunJS(e.data.code) : e.type === x && this.store.clearCaptureScreenList();
146
146
  }
147
147
  );
148
148
  }
@@ -273,16 +273,16 @@ class Y {
273
273
  * @param {string} key
274
274
  * @memberof DevEvent
275
275
  */
276
- removeStorage(e) {
277
- this.store.removeStorage(e), this.postMessage();
276
+ removeStorage(e, t) {
277
+ this.store.removeStorage(e, t), this.postMessage();
278
278
  }
279
279
  /**
280
280
  * 清除缓存
281
281
  *
282
282
  * @memberof DevEvent
283
283
  */
284
- clearStorage() {
285
- this.store.clearStorageList();
284
+ clearStorage(e) {
285
+ this.store.clearStorageList(e);
286
286
  }
287
287
  /**
288
288
  * 重置 storage 函数
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../dev/devIntercept/index.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AASvC;;;;;GAKG;AACH,qBAAa,YAAY;IAC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SAAS,gBAAa;gBAEV,OAAO,EAAE,OAAO,CAAC,mBAAmB;IAKhD,IAAI,CAAC,OAAO,EAAE,OAAO,CAAC,mBAAmB;IAqBzC;;;;OAIG;IACH,mBAAmB;IA8BnB;;;;OAIG;IACH,YAAY,CAAC,WAAW,EAAE,GAAG;IA+B7B;;;;OAIG;IACH,iBAAiB;IA0BjB;;;;;OAKG;IACH,iBAAiB,CAAC,KAAK,EAAE,KAAK;IAuB9B,OAAO,EAAE,GAAG,CAAC;IACb;;;;;;OAMG;IACH,gBAAgB,CAAC,IAAI,EAAE,MAAM;IAgC7B;;;;OAIG;IACH,sBAAsB;IAStB;;;;OAIG;IACH,kBAAkB;IAelB;;;;OAIG;IACH,mBAAmB;IAcnB;;;;OAIG;IACH,gBAAgB;IAmEhB;;;;OAIG;IACH,eAAe;IAmKf;;;;OAIG;IACH,mBAAmB;IAmCnB;;;;OAIG;IACH,qBAAqB;IAiBrB;;;;OAIG;IACH,sBAAsB;IAsBtB,aAAa;IACb,oBAAoB,CAAC,KAAK,EAAE,GAAG;IAQ/B,cAAc;IACd,mBAAmB,CAAC,OAAO,EAAE,GAAG;IAgBhC;;;;OAIG;IACH,mBAAmB;IAyFnB,wBAAwB,CAAC,IAAI,EAAE,OAAO,CAAC,aAAa;IAqBpD,iBAAiB;IAQjB;;;;OAIG;IACH,sBAAsB;CAYvB"}
@@ -2,10 +2,10 @@ import { backup as v } from "../core.js";
2
2
  import "../utils/index.js";
3
3
  import { transformValueToView as E } from "../utils/language.js";
4
4
  import { getCurrentPagePath as f } from "../utils/page.js";
5
- import { getCurrentDate as S } from "../utils/date.js";
5
+ import { getCurrentDate as p } from "../utils/date.js";
6
6
  import { parseValue as C } from "../utils/object.js";
7
- import { escapeHTML as U } from "../utils/string.js";
8
- class V {
7
+ import { escapeHTML as P } from "../utils/string.js";
8
+ class I {
9
9
  constructor(e) {
10
10
  this.initPinia = !1, this.cache$on = /* @__PURE__ */ new Map(), this.cache$once = /* @__PURE__ */ new Map(), this.cache$emit = /* @__PURE__ */ new Map(), this.cache$off = /* @__PURE__ */ new Map(), this.event = e.event, this.init(e);
11
11
  }
@@ -21,16 +21,16 @@ class V {
21
21
  if (!uni.__log__)
22
22
  return;
23
23
  const e = this;
24
- uni.__log__ = function(s, t, ...i) {
25
- const a = f();
26
- v.__log__(s, t, ...i), e.event.updateConsoleList([
24
+ uni.__log__ = function(r, t, ...n) {
25
+ const s = f();
26
+ v.__log__(r, t, ...n), e.event.updateConsoleList([
27
27
  {
28
- type: s,
29
- position: a,
30
- time: S(),
31
- args: i.map((l) => ({
32
- type: E(l),
33
- value: C(l)
28
+ type: r,
29
+ position: s,
30
+ time: p(),
31
+ args: n.map((c) => ({
32
+ type: E(c),
33
+ value: C(c)
34
34
  })),
35
35
  stack: t
36
36
  }
@@ -45,13 +45,13 @@ class V {
45
45
  interceptVue(e) {
46
46
  if (!e)
47
47
  return;
48
- const s = (i, a, l) => {
49
- this.event.getDevToolDestroy() || this.interceptErrorVue(i);
50
- }, t = (i, a, l) => {
51
- this.event.getDevToolDestroy() || this.interceptWarnVue(i + `
52
- ` + l);
48
+ const r = (n, s, c) => {
49
+ this.event.getDevToolDestroy() || this.interceptErrorVue(n);
50
+ }, t = (n, s, c) => {
51
+ this.event.getDevToolDestroy() || this.interceptWarnVue(n + `
52
+ ` + c);
53
53
  };
54
- e.appContext ? (e.appContext.config.errorHandler = s, e.appContext.config.warnHandler = t) : (e.config.errorHandler = s, e.config.warnHandler = t);
54
+ e.appContext ? (e.appContext.config.errorHandler = r, e.appContext.config.warnHandler = t) : (e.config.errorHandler = r, e.config.warnHandler = t);
55
55
  }
56
56
  /**
57
57
  * app 中捕获全局错误
@@ -60,22 +60,22 @@ class V {
60
60
  */
61
61
  interceptAppError() {
62
62
  uni.onError((e) => {
63
- var i, a;
63
+ var n, s;
64
64
  if (this.event.getDevToolDestroy())
65
65
  return;
66
- const s = e.toString(), t = ((a = (i = e == null ? void 0 : e.stack) == null ? void 0 : i.split(`
67
- `)) == null ? void 0 : a[1]) ?? "";
66
+ const r = e.toString(), t = ((s = (n = e == null ? void 0 : e.stack) == null ? void 0 : n.split(`
67
+ `)) == null ? void 0 : s[1]) ?? "";
68
68
  this.event.updateConsoleList([
69
69
  {
70
70
  type: "error",
71
71
  args: [
72
72
  {
73
73
  type: "string",
74
- value: s
74
+ value: r
75
75
  }
76
76
  ],
77
77
  position: f(),
78
- time: S(),
78
+ time: p(),
79
79
  stack: t
80
80
  }
81
81
  ]);
@@ -88,9 +88,9 @@ class V {
88
88
  * @memberof DevIntercept
89
89
  */
90
90
  interceptErrorVue(e) {
91
- var i;
92
- const s = (i = e == null ? void 0 : e.stack) == null ? void 0 : i.split(`
93
- `), t = s == null ? void 0 : s[1];
91
+ var n;
92
+ const r = (n = e == null ? void 0 : e.stack) == null ? void 0 : n.split(`
93
+ `), t = r == null ? void 0 : r[1];
94
94
  console.error(e), this.event.updateConsoleList([
95
95
  {
96
96
  type: "error",
@@ -101,7 +101,7 @@ class V {
101
101
  }
102
102
  ],
103
103
  position: f(),
104
- time: S(),
104
+ time: p(),
105
105
  stack: t
106
106
  }
107
107
  ]);
@@ -114,15 +114,15 @@ class V {
114
114
  * @memberof DevIntercept
115
115
  */
116
116
  interceptWarnVue(e) {
117
- var l, n, c, h;
117
+ var c, i, l, o;
118
118
  if (this.preWarn === e)
119
119
  return;
120
120
  this.preWarn = e;
121
- const s = f(), t = (n = (l = new Error()) == null ? void 0 : l.stack) == null ? void 0 : n.split(`
122
- `), i = (c = t == null ? void 0 : t.slice(2)) == null ? void 0 : c[0];
121
+ const r = f(), t = (i = (c = new Error()) == null ? void 0 : c.stack) == null ? void 0 : i.split(`
122
+ `), n = (l = t == null ? void 0 : t.slice(2)) == null ? void 0 : l[0];
123
123
  console.warn(e);
124
- const a = (h = e.split(`
125
- `)) == null ? void 0 : h.map((o) => U(o)).join(`
124
+ const s = (o = e.split(`
125
+ `)) == null ? void 0 : o.map((m) => P(m)).join(`
126
126
  `);
127
127
  this.event.updateConsoleList([
128
128
  {
@@ -130,12 +130,12 @@ class V {
130
130
  args: [
131
131
  {
132
132
  type: "string",
133
- value: a
133
+ value: s
134
134
  }
135
135
  ],
136
- position: s,
137
- time: S(),
138
- stack: i
136
+ position: r,
137
+ time: p(),
138
+ stack: n
139
139
  }
140
140
  ]);
141
141
  }
@@ -159,13 +159,13 @@ class V {
159
159
  interceptSwitchTab() {
160
160
  const e = this;
161
161
  uni.addInterceptor("switchTab", {
162
- invoke(s) {
163
- const t = s.complete;
164
- s.complete = function(i) {
165
- var l, n, c;
166
- t && t(i);
167
- const a = ((c = (n = (l = s.url) == null ? void 0 : l.slice(1)) == null ? void 0 : n.split("?")) == null ? void 0 : c[0]) || "/";
168
- e.event.updateCurrentPagePath(a);
162
+ invoke(r) {
163
+ const t = r.complete;
164
+ r.complete = function(n) {
165
+ var c, i, l;
166
+ t && t(n);
167
+ const s = ((l = (i = (c = r.url) == null ? void 0 : c.slice(1)) == null ? void 0 : i.split("?")) == null ? void 0 : l[0]) || "/";
168
+ e.event.updateCurrentPagePath(s);
169
169
  };
170
170
  }
171
171
  });
@@ -178,13 +178,13 @@ class V {
178
178
  interceptNavigateTo() {
179
179
  const e = this;
180
180
  uni.addInterceptor("navigateTo", {
181
- invoke(s) {
182
- const t = s.complete;
183
- s.complete = function(i) {
184
- var l, n, c;
185
- t && t(i);
186
- const a = ((c = (n = (l = s.url) == null ? void 0 : l.slice(1)) == null ? void 0 : n.split("?")) == null ? void 0 : c[0]) || "/";
187
- e.event.updateCurrentPagePath(a);
181
+ invoke(r) {
182
+ const t = r.complete;
183
+ r.complete = function(n) {
184
+ var c, i, l;
185
+ t && t(n);
186
+ const s = ((l = (i = (c = r.url) == null ? void 0 : c.slice(1)) == null ? void 0 : i.split("?")) == null ? void 0 : l[0]) || "/";
187
+ e.event.updateCurrentPagePath(s);
188
188
  };
189
189
  }
190
190
  });
@@ -197,46 +197,46 @@ class V {
197
197
  interceptRequest() {
198
198
  const e = this;
199
199
  uni.addInterceptor("request", {
200
- invoke(s) {
201
- var u, g, T;
202
- const t = e.event.getRequestIndex(), i = e.event.setRequestIndex(t + 1), a = s.url, l = (u = a == null ? void 0 : a.split("?")) == null ? void 0 : u[0], n = l == null ? void 0 : l.lastIndexOf("/"), c = (l == null ? void 0 : l.slice(n + 1)) ?? "", h = (T = (g = new Error()) == null ? void 0 : g.stack) == null ? void 0 : T.split(`
203
- `), o = h == null ? void 0 : h[5], r = {
204
- index: i,
205
- stack: o,
206
- url: s.url,
207
- name: c,
200
+ invoke(r) {
201
+ var u, S, k;
202
+ const t = e.event.getRequestIndex(), n = e.event.setRequestIndex(t + 1), s = r.url, c = (u = s == null ? void 0 : s.split("?")) == null ? void 0 : u[0], i = c == null ? void 0 : c.lastIndexOf("/"), l = (c == null ? void 0 : c.slice(i + 1)) ?? "", o = (k = (S = new Error()) == null ? void 0 : S.stack) == null ? void 0 : k.split(`
203
+ `), m = o == null ? void 0 : o[5], a = {
204
+ index: n,
205
+ stack: m,
206
+ url: r.url,
207
+ name: l,
208
208
  startTime: Date.now(),
209
209
  endTime: 0,
210
210
  time: "-",
211
211
  headers: {
212
- requestHeader: Object.entries(s.header ?? {}).map(
213
- ([m, p]) => ({
214
- key: m,
215
- value: p
212
+ requestHeader: Object.entries(r.header ?? {}).map(
213
+ ([h, g]) => ({
214
+ key: h,
215
+ value: g
216
216
  })
217
217
  ),
218
218
  responseHeader: []
219
219
  },
220
- method: s.method || "GET",
220
+ method: r.method || "GET",
221
221
  status: "pending",
222
- payload: s != null && s.data ? JSON.stringify(s.data) : "",
222
+ payload: r != null && r.data ? JSON.stringify(r.data) : "",
223
223
  response: "",
224
224
  size: ""
225
225
  };
226
- e.event.updateNetworkList([r]);
227
- let d = s.complete;
228
- s.complete = function(m) {
229
- var k, w;
230
- d && d(m), r.status = m.statusCode ?? "error", r.endTime = Date.now();
231
- const p = Date.now() - r.startTime;
232
- r.time = p < 1e3 ? p + "ms" : p / 1e3 + "s";
233
- const y = ((k = m == null ? void 0 : m.header) == null ? void 0 : k["Content-Length"]) || ((w = m == null ? void 0 : m.header) == null ? void 0 : w["content-length"]) || 0;
234
- r.size = y > 1024 ? (y / 1024).toFixed(2) + "k" : y + "b", r.response = m, r.headers.responseHeader = Object.entries(
235
- m.header ?? {}
226
+ e.event.updateNetworkList([a]);
227
+ let d = r.complete;
228
+ r.complete = function(h) {
229
+ var T, w;
230
+ d && d(h), a.status = h.statusCode ?? "error", a.endTime = Date.now();
231
+ const g = Date.now() - a.startTime;
232
+ a.time = g < 1e3 ? g + "ms" : g / 1e3 + "s";
233
+ const y = ((T = h == null ? void 0 : h.header) == null ? void 0 : T["Content-Length"]) || ((w = h == null ? void 0 : h.header) == null ? void 0 : w["content-length"]) || 0;
234
+ a.size = y > 1024 ? (y / 1024).toFixed(2) + "k" : y + "b", a.response = h, a.headers.responseHeader = Object.entries(
235
+ h.header ?? {}
236
236
  ).map(([L, D]) => ({
237
237
  key: L,
238
238
  value: D
239
- })), e.event.updateNetworkList([r], i);
239
+ })), e.event.updateNetworkList([a], n);
240
240
  };
241
241
  }
242
242
  });
@@ -247,27 +247,27 @@ class V {
247
247
  * @memberof DevIntercept
248
248
  */
249
249
  interceptSocket() {
250
- const e = this, s = function(t) {
251
- const i = t.url, a = Object.entries(t.header ?? {}).map(
252
- ([r, d]) => ({ key: r, value: d })
253
- ), l = (t.method ?? "GET").toLowerCase(), n = t.protocols ?? [];
250
+ const e = this, r = function(t) {
251
+ const n = t.url, s = Object.entries(t.header ?? {}).map(
252
+ ([a, d]) => ({ key: a, value: d })
253
+ ), c = (t.method ?? "GET").toLowerCase(), i = t.protocols ?? [];
254
254
  e.event.updateWsList({
255
- url: i,
256
- headers: a,
257
- method: l,
258
- protocols: n,
255
+ url: n,
256
+ headers: s,
257
+ method: c,
258
+ protocols: i,
259
259
  readyState: "connection",
260
260
  message: []
261
261
  });
262
- const c = v.connectSocket({
262
+ const l = v.connectSocket({
263
263
  ...t,
264
- success: (r) => {
264
+ success: (a) => {
265
265
  var d;
266
- (d = t.success) == null || d.call(t, r), e.event.updateWsList({
267
- url: i,
266
+ (d = t.success) == null || d.call(t, a), e.event.updateWsList({
267
+ url: n,
268
268
  readyState: "open",
269
- headers: a,
270
- protocols: n,
269
+ headers: s,
270
+ protocols: i,
271
271
  message: [
272
272
  {
273
273
  data: "连接成功",
@@ -277,13 +277,13 @@ class V {
277
277
  ]
278
278
  });
279
279
  },
280
- fail: (r) => {
280
+ fail: (a) => {
281
281
  var d;
282
- (d = t.fail) == null || d.call(t, r), e.event.updateWsList({
283
- url: i,
282
+ (d = t.fail) == null || d.call(t, a), e.event.updateWsList({
283
+ url: n,
284
284
  readyState: "error",
285
- headers: a,
286
- protocols: n,
285
+ headers: s,
286
+ protocols: i,
287
287
  message: [
288
288
  {
289
289
  data: "连接失败",
@@ -293,21 +293,21 @@ class V {
293
293
  ]
294
294
  });
295
295
  },
296
- complete: (r) => {
296
+ complete: (a) => {
297
297
  var d;
298
- (d = t == null ? void 0 : t.complete) == null || d.call(t, r);
298
+ (d = t == null ? void 0 : t.complete) == null || d.call(t, a);
299
299
  }
300
- }), h = c.send;
301
- c.send = (r) => {
302
- h.call(c, {
303
- data: r.data,
300
+ }), o = l.send;
301
+ l.send = (a) => {
302
+ o.call(l, {
303
+ data: a.data,
304
304
  fail: (d) => {
305
305
  var u;
306
- (u = r == null ? void 0 : r.fail) == null || u.call(r, d), e.event.updateWsList({
307
- url: i,
306
+ (u = a == null ? void 0 : a.fail) == null || u.call(a, d), e.event.updateWsList({
307
+ url: n,
308
308
  readyState: "error",
309
- headers: a,
310
- protocols: n,
309
+ headers: s,
310
+ protocols: i,
311
311
  message: [
312
312
  {
313
313
  data: JSON.stringify(d),
@@ -318,78 +318,78 @@ class V {
318
318
  });
319
319
  },
320
320
  success: (d) => {
321
- var u, g;
322
- (u = r == null ? void 0 : r.success) == null || u.call(r, d), e.event.updateWsList({
321
+ var u, S;
322
+ (u = a == null ? void 0 : a.success) == null || u.call(a, d), e.event.updateWsList({
323
323
  readyState: "open",
324
- url: i,
325
- headers: a,
326
- protocols: n,
324
+ url: n,
325
+ headers: s,
326
+ protocols: i,
327
327
  message: [
328
328
  {
329
329
  type: "success",
330
330
  time: Date.now(),
331
- data: (g = r.data) == null ? void 0 : g.toString()
331
+ data: (S = a.data) == null ? void 0 : S.toString()
332
332
  }
333
333
  ]
334
334
  });
335
335
  },
336
336
  complete: (d) => {
337
337
  var u;
338
- (u = r == null ? void 0 : r.complete) == null || u.call(r, d);
338
+ (u = a == null ? void 0 : a.complete) == null || u.call(a, d);
339
339
  }
340
340
  });
341
341
  };
342
- const o = c.close;
343
- return c.close = (r) => {
342
+ const m = l.close;
343
+ return l.close = (a) => {
344
344
  e.event.updateWsList({
345
- url: i,
345
+ url: n,
346
346
  readyState: "closing",
347
- headers: a,
348
- protocols: n,
347
+ headers: s,
348
+ protocols: i,
349
349
  message: []
350
- }), o.call(c, {
351
- ...r,
350
+ }), m.call(l, {
351
+ ...a,
352
352
  fail: (d) => {
353
353
  var u;
354
- (u = r == null ? void 0 : r.fail) == null || u.call(r, d), e.event.updateWsList({
355
- url: i,
356
- headers: a,
354
+ (u = a == null ? void 0 : a.fail) == null || u.call(a, d), e.event.updateWsList({
355
+ url: n,
356
+ headers: s,
357
357
  readyState: "open",
358
- protocols: n,
358
+ protocols: i,
359
359
  message: []
360
360
  });
361
361
  },
362
362
  success: (d) => {
363
363
  var u;
364
- (u = r == null ? void 0 : r.success) == null || u.call(r, d), e.event.updateWsList({
365
- url: i,
366
- headers: a,
364
+ (u = a == null ? void 0 : a.success) == null || u.call(a, d), e.event.updateWsList({
365
+ url: n,
366
+ headers: s,
367
367
  readyState: "closed",
368
- protocols: n,
368
+ protocols: i,
369
369
  message: []
370
370
  });
371
371
  },
372
372
  complete: (d) => {
373
373
  var u;
374
- (u = r == null ? void 0 : r.complete) == null || u.call(r, d);
374
+ (u = a == null ? void 0 : a.complete) == null || u.call(a, d);
375
375
  }
376
376
  });
377
- }, c.onMessage((r) => {
377
+ }, l.onMessage((a) => {
378
378
  e.event.updateWsList({
379
- url: i,
380
- headers: a,
381
- protocols: n,
379
+ url: n,
380
+ headers: s,
381
+ protocols: i,
382
382
  message: [
383
383
  {
384
384
  type: "success",
385
385
  time: Date.now(),
386
- data: JSON.parse(r.data)
386
+ data: JSON.parse(a.data)
387
387
  }
388
388
  ]
389
389
  });
390
- }), c;
390
+ }), l;
391
391
  };
392
- uni.connectSocket = s;
392
+ uni.connectSocket = r;
393
393
  }
394
394
  /**
395
395
  * 拦截 uni.setStorageSync 和 uni.setStorage
@@ -397,30 +397,32 @@ class V {
397
397
  * @memberof DevIntercept
398
398
  */
399
399
  interceptSetStorage() {
400
- uni.setStorageSync = (e, s) => {
401
- v.setStorageSync(e.toString(), s), this.event.updateStoreList([
402
- {
403
- key: e.toString(),
404
- _oldKey: e.toString(),
405
- value: s
406
- }
407
- ]);
408
- }, uni.setStorage = (e) => {
409
- var s;
410
- v.setStorage({
411
- ...e,
412
- key: (s = e.key) == null ? void 0 : s.toString()
413
- }).then(() => {
414
- var t, i;
415
- this.event.updateStoreList([
400
+ const e = this;
401
+ Object.defineProperty(uni, "setStorageSync", {
402
+ value: function(r, t) {
403
+ v.setStorageSync(r.toString(), t), e.event.updateStoreList([
416
404
  {
417
- key: (t = e.key) == null ? void 0 : t.toString(),
418
- _oldKey: (i = e.key) == null ? void 0 : i.toString(),
419
- value: e.data
405
+ key: r.toString(),
406
+ _oldKey: r.toString(),
407
+ value: t
420
408
  }
421
409
  ]);
422
- });
423
- };
410
+ }
411
+ }), uni.addInterceptor("setStorage", {
412
+ invoke(r) {
413
+ const t = r.complete;
414
+ r.complete = function(n) {
415
+ var s, c;
416
+ t && t(n), e.event.updateStoreList([
417
+ {
418
+ key: (s = r.key) == null ? void 0 : s.toString(),
419
+ _oldKey: (c = r.key) == null ? void 0 : c.toString(),
420
+ value: r.data
421
+ }
422
+ ]);
423
+ };
424
+ }
425
+ });
424
426
  }
425
427
  /**
426
428
  * 拦截 uni.clearStorageSync 和 uni.clearStorage
@@ -428,11 +430,16 @@ class V {
428
430
  * @memberof DevIntercept
429
431
  */
430
432
  interceptClearStorage() {
431
- uni.clearStorageSync = () => {
432
- v.clearStorageSync(), this.event.clearStorage();
433
- }, uni.clearStorage = () => {
434
- v.clearStorage(), this.event.clearStorage();
435
- };
433
+ const e = this;
434
+ Object.defineProperty(uni, "clearStorage", {
435
+ value: function() {
436
+ v.clearStorage(), e.event.clearStorage();
437
+ }
438
+ }), uni.addInterceptor("clearStorage", {
439
+ invoke() {
440
+ e.event.clearStorage();
441
+ }
442
+ });
436
443
  }
437
444
  /**
438
445
  * 拦截 uni.removeStorageSync 和 uni.removeStorage
@@ -440,25 +447,31 @@ class V {
440
447
  * @memberof DevIntercept
441
448
  */
442
449
  interceptRemoveStorage() {
443
- uni.removeStorageSync = (e) => {
444
- v.removeStorageSync(e), this.event.removeStorage(e);
445
- }, uni.removeStorage = (e) => {
446
- v.removeStorage(e).then(() => {
447
- this.event.removeStorage(e.key);
448
- });
449
- };
450
+ const e = this;
451
+ Object.defineProperty(uni, "removeStorageSync", {
452
+ value: function(r) {
453
+ v.removeStorageSync(r), e.event.removeStorage(r);
454
+ }
455
+ }), uni.addInterceptor("removeStorage", {
456
+ invoke(r) {
457
+ const t = r.complete;
458
+ r.complete = function(n) {
459
+ t && t(n), e.event.removeStorage(r.key);
460
+ };
461
+ }
462
+ });
450
463
  }
451
464
  /** 拦截vuex */
452
465
  interceptVuexStorage(e) {
453
- var s;
454
- this.event.setVuexList(e.state), (s = e == null ? void 0 : e.subscribe) == null || s.call(e, (t, i) => {
455
- this.event.setVuexList(i);
466
+ var r;
467
+ this.event.setVuexList(e.state), (r = e == null ? void 0 : e.subscribe) == null || r.call(e, (t, n) => {
468
+ this.event.setVuexList(n);
456
469
  });
457
470
  }
458
471
  /** 拦截pinia */
459
472
  interceptPiniaStore(e) {
460
- var s;
461
- return this.initPinia || (this.initPinia = !0, this.event.setPiniaStore(e.pinia)), this.event.setPiniaList(e.pinia.state.value), (s = e == null ? void 0 : e.store) == null || s.$subscribe(() => {
473
+ var r;
474
+ return this.initPinia || (this.initPinia = !0, this.event.setPiniaStore(e.pinia)), this.event.setPiniaList(e.pinia.state.value), (r = e == null ? void 0 : e.store) == null || r.$subscribe(() => {
462
475
  this.event.setPiniaList({
463
476
  [e.store.$id]: e.store.$state
464
477
  });
@@ -470,19 +483,19 @@ class V {
470
483
  * @memberof DevIntercept
471
484
  */
472
485
  interceptUploadFile() {
473
- const e = this, s = (t) => {
474
- const i = e.event.getUploadIndex(), a = e.event.setUploadIndex(i + 1);
486
+ const e = this, r = (t) => {
487
+ const n = e.event.getUploadIndex(), s = e.event.setUploadIndex(n + 1);
475
488
  e.event.updateUploadList(
476
489
  [
477
490
  {
478
- index: a,
491
+ index: s,
479
492
  name: t.name,
480
493
  url: t.url,
481
494
  filePath: t.filePath,
482
495
  fileType: t.fileType,
483
496
  headers: {
484
497
  requestHeader: Object.entries(t.header || {}).map(
485
- ([n, c]) => ({ key: n, value: c })
498
+ ([i, l]) => ({ key: i, value: l })
486
499
  ),
487
500
  responseHeader: []
488
501
  },
@@ -494,70 +507,70 @@ class V {
494
507
  startTime: Date.now()
495
508
  }
496
509
  ],
497
- a
510
+ s
498
511
  );
499
- const l = v.uploadFile({
512
+ const c = v.uploadFile({
500
513
  ...t,
501
- success: (n) => {
502
- var c;
503
- (c = t == null ? void 0 : t.success) == null || c.call(t, n), e.event.updateUploadList(
514
+ success: (i) => {
515
+ var l;
516
+ (l = t == null ? void 0 : t.success) == null || l.call(t, i), e.event.updateUploadList(
504
517
  [
505
518
  {
506
- index: a,
519
+ index: s,
507
520
  status: "success",
508
521
  endTime: Date.now(),
509
522
  response: {
510
- ...n,
511
- data: JSON.parse(n.data)
523
+ ...i,
524
+ data: JSON.parse(i.data)
512
525
  }
513
526
  }
514
527
  ],
515
- a
516
- ), e.event.removeUploadTask(a);
528
+ s
529
+ ), e.event.removeUploadTask(s);
517
530
  },
518
- fail: (n) => {
519
- var c;
520
- (c = t == null ? void 0 : t.fail) == null || c.call(t, n), e.event.updateUploadList(
531
+ fail: (i) => {
532
+ var l;
533
+ (l = t == null ? void 0 : t.fail) == null || l.call(t, i), e.event.updateUploadList(
521
534
  [
522
535
  {
523
- index: a,
536
+ index: s,
524
537
  status: "error",
525
- response: n,
538
+ response: i,
526
539
  endTime: Date.now()
527
540
  }
528
541
  ],
529
- a
530
- ), e.event.removeUploadTask(a);
542
+ s
543
+ ), e.event.removeUploadTask(s);
531
544
  }
532
545
  });
533
- return l.onProgressUpdate((n) => {
546
+ return c.onProgressUpdate((i) => {
534
547
  e.event.updateUploadList(
535
548
  [
536
549
  {
537
- index: a,
538
- progress: n.progress,
539
- totalBytesSent: n.totalBytesSent,
540
- totalBytesExpectedToSend: n.totalBytesExpectedToSend,
550
+ index: s,
551
+ progress: i.progress,
552
+ totalBytesSent: i.totalBytesSent,
553
+ totalBytesExpectedToSend: i.totalBytesExpectedToSend,
541
554
  status: "uploading"
542
555
  }
543
556
  ],
544
- a
557
+ s
545
558
  );
546
- }), e.event.addUploadTask(a, l), l;
559
+ }), e.event.addUploadTask(s, c), c;
547
560
  };
548
- uni.uploadFile = s.bind(uni);
561
+ uni.uploadFile = r.bind(uni);
549
562
  }
550
563
  interceptUniEventFactory(e) {
551
- const s = `$${e}`;
552
- uni[`$${e}`] = (t, i) => {
553
- var n, c, h, o;
554
- const a = (c = (n = new Error()) == null ? void 0 : n.stack) == null ? void 0 : c.split(`
555
- `), l = a == null ? void 0 : a[2];
556
- (o = (h = v) == null ? void 0 : h[s]) == null || o.call(h, t, i), this.event.updateUniEventList([
564
+ const r = `$${e}`;
565
+ uni[`$${e}`] = (t, n) => {
566
+ var i, l, o, m;
567
+ const s = (l = (i = new Error()) == null ? void 0 : i.stack) == null ? void 0 : l.split(`
568
+ `), c = s == null ? void 0 : s[2];
569
+ (m = (o = v) == null ? void 0 : o[r]) == null || m.call(o, t, n), this.event.updateUniEventList([
557
570
  {
558
571
  eventName: t,
559
- timer: S(),
560
- stack: l,
572
+ timer: p(),
573
+ stack: c,
561
574
  type: e
562
575
  }
563
576
  ]), this.event.updateUniEventCount(e);
@@ -576,12 +589,12 @@ class V {
576
589
  this.event.getDevToolDestroy() || this.event.updateCaptureScreenList([
577
590
  {
578
591
  position: f(),
579
- timer: S()
592
+ timer: p()
580
593
  }
581
594
  ]);
582
595
  });
583
596
  }
584
597
  }
585
598
  export {
586
- V as DevIntercept
599
+ I as DevIntercept
587
600
  };
@@ -134,13 +134,13 @@ export declare class DevStore {
134
134
  clearWsList(): void;
135
135
  updateWsList(item: DevTool.WS): DevTool.WS[] | undefined;
136
136
  clearWsMessage(url: string): void;
137
- clearStorageList(): DevTool.StorageItem[];
137
+ clearStorageList(local?: boolean): DevTool.StorageItem[];
138
138
  setStorageList(items: DevTool.StorageItem[]): DevTool.StorageItem[] | undefined;
139
- removeStorage(key: string): DevTool.StorageItem[];
139
+ removeStorage(key: string, local?: boolean): DevTool.StorageItem[];
140
140
  addStorage(data: {
141
141
  key: string;
142
142
  value: any;
143
- }): DevTool.StorageItem[] | undefined;
143
+ }, local?: boolean): DevTool.StorageItem[] | undefined;
144
144
  refreshStore(): DevTool.StorageItem[];
145
145
  updateStoreList(addItems: DevTool.StorageItem[]): DevTool.StorageItem[] | undefined;
146
146
  setRouteList(pages: DevTool.Page[], currentPath?: string): DevTool.Page[] | undefined;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../dev/devStore/index.ts"],"names":[],"mappings":";AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAgBvC,cAAc;AACd,qBAAa,QAAQ;IACnB,WAAW;IACX,OAAO,CAAC,KAAK,CAsBX;IAEF,WAAW;IACX,OAAO,CAAC,cAAc,CAAqC;IAC3D,YAAY;IACZ,OAAO,CAAC,aAAa,CAAQ;IAC7B,YAAY;IACZ,OAAO,CAAC,cAAc,CAAQ;IAC9B,YAAY;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CAAC,EAAE,MAAM;IAsBxD,YAAY;IAIZ,qBAAqB,CAAC,IAAI,EAAE,MAAM;IA0BlC,cAAc,CAAC,KAAK,EAAE,OAAO,CAAC,WAAW,EAAE;IAY3C,iBAAiB,CAAC,QAAQ,EAAE,OAAO,CAAC,WAAW,EAAE,EAAE,KAAK,CAAC,EAAE,MAAM;IAqBjE,gBAAgB;IAIhB,cAAc,CAAC,KAAK,EAAE,OAAO,CAAC,WAAW,EAAE;IAW3C,iBAAiB,CAAC,QAAQ,EAAE,OAAO,CAAC,WAAW,EAAE,EAAE,KAAK,CAAC,EAAE,MAAM;IAiBjE,gBAAgB,CAAC,QAAQ,EAAE,OAAO,CAAC,UAAU,EAAE,EAAE,KAAK,CAAC,EAAE,MAAM;IAmB/D,eAAe;IAIf,iBAAiB,CAAC,OAAO,EAAE,OAAO;IAQlC,iBAAiB;IAMjB,kBAAkB;IASlB;;;;;OAKG;IACH,YAAY,CAAC,KAAK,EAAE,OAAO,CAAC,SAAS;IAOrC;;;;;OAKG;IACH,mBAAmB,CAAC,IAAI,EAAE,OAAO,CAAC,aAAa;IAY/C,kBAAkB,CAAC,QAAQ,EAAE,OAAO,CAAC,SAAS,EAAE;IAYhD,aAAa;IAUb,uBAAuB,CAAC,iBAAiB,EAAE,OAAO,CAAC,iBAAiB,EAAE;IActE,sBAAsB;CAGvB"}
@@ -219,25 +219,25 @@ class V {
219
219
  const e = ((o = (s = this.state) == null ? void 0 : s.wsList) == null ? void 0 : o.findIndex((a) => a.url === t)) ?? -1;
220
220
  e !== -1 && (i = this.state.wsList) != null && i[e] && (this.state.wsList[e].message = []);
221
221
  }
222
- clearStorageList() {
223
- return this.state.storageList = [], uni.clearStorage(), this.state.storageList;
222
+ clearStorageList(t) {
223
+ return this.state.storageList = [], t && uni.clearStorage(), this.state.storageList;
224
224
  }
225
225
  setStorageList(t) {
226
226
  if (this.getDevToolVisible())
227
227
  return this.state.storageList = t, this.state.storageList;
228
228
  }
229
- removeStorage(t) {
230
- var e;
231
- return this.state.storageList = ((e = this.state.storageList) == null ? void 0 : e.filter((s) => s.key !== t)) ?? [], uni.removeStorageSync(t), this.state.storageList;
229
+ removeStorage(t, e) {
230
+ var s;
231
+ return this.state.storageList = ((s = this.state.storageList) == null ? void 0 : s.filter((o) => o.key !== t)) ?? [], e && uni.removeStorageSync(t), this.state.storageList;
232
232
  }
233
- addStorage(t) {
234
- var o;
235
- const { key: e, value: s } = t;
236
- return (o = this.state.storageList) == null || o.unshift({
237
- key: e,
238
- _oldKey: e,
239
- value: s
240
- }), uni.setStorageSync(e, s), this.state.storageList;
233
+ addStorage(t, e) {
234
+ var i;
235
+ const { key: s, value: o } = t;
236
+ return (i = this.state.storageList) == null || i.unshift({
237
+ key: s,
238
+ _oldKey: s,
239
+ value: o
240
+ }), e && uni.setStorageSync(s, o), this.state.storageList;
241
241
  }
242
242
  refreshStore() {
243
243
  const { keys: t } = uni.getStorageInfoSync();
@@ -140,14 +140,14 @@ export default {
140
140
 
141
141
  // 向上滚动时加载前面的数据
142
142
  if (
143
- this.current > 1 &&
143
+ this.current > 0 &&
144
144
  this.currentHeight > 0 &&
145
145
  scrollTop - this.preLodeHeight < this.currentHeight
146
146
  ) {
147
147
  this.start = this.current * this.pageSize;
148
148
  this.current--;
149
149
 
150
- this.updateVisitableData('up');
150
+ this.updateVisitableData();
151
151
  this.updateCurrentHeight();
152
152
  }
153
153
  },
@@ -159,7 +159,7 @@ export default {
159
159
 
160
160
  this.updateCurrentHeight();
161
161
  this.$nextTick(() => {
162
- this.updateVisitableData('down');
162
+ this.updateVisitableData();
163
163
  });
164
164
  }
165
165
  },
@@ -183,8 +183,12 @@ export default {
183
183
  },
184
184
  // 更新总高度(累加已加载项的高度)
185
185
  updateCurrentHeight() {
186
+ const pageSize = this.pageSize;
187
+ const current = this.current;
188
+ const currentSub1 = current - 1 < 0 ? 0 : current - 1;
189
+
186
190
  const total = this.itemsHeight
187
- .slice(0, (this.current - 1) * this.pageSize)
191
+ .slice(0, currentSub1 * pageSize)
188
192
  .reduce((acc, height) => acc + (height || 0), 0);
189
193
  this.currentHeight = total;
190
194
  },
@@ -1,7 +1,7 @@
1
1
  <template>
2
2
  <view class="setting-content">
3
3
  <view class="setting-item">
4
- <DevToolTitle>DevTool(v0.0.19-vue3)</DevToolTitle>
4
+ <DevToolTitle>DevTool(v0.0.20-vue3)</DevToolTitle>
5
5
  <view class="setting-item-content">
6
6
  <view class="setting-row">
7
7
  <view>显示调试按钮:</view>
@@ -9,36 +9,49 @@
9
9
  <CircularButton style="margin-left: auto" text="×" @click="onClose" />
10
10
  </view>
11
11
  <view class="dev-tool-code-title">{{ fileName }}</view>
12
- <scroll-view
13
- scroll-y="true"
14
- scroll-x="true"
15
- class="dev-tool-code-list"
16
- scroll-with-animation="true"
17
- :scroll-top="scrollTop"
18
- :scroll-into-view="scrollIntoView"
12
+
13
+ <VirtualListPro
14
+ v-if="codes.length > 0"
15
+ scrollX
16
+ :pageSize="pageSize"
17
+ :height="height"
18
+ :data="codes"
19
+ :scrollWithAnimation="true"
20
+ :defaultCurrent="defaultCurrent"
21
+ :scrollIntoView="scrollIntoView"
19
22
  >
20
- <view
21
- v-for="(code, index) in codes"
22
- :id="`dev-tool-code-item-${index}`"
23
- :key="index"
24
- :class="`dev-tool-code-item ${index === activeRowCol.activeRow ? 'dev-tool-code-item-active' : ''}`"
25
- >
26
- <view class="dev-tool-code-item-index">
27
- {{ start + index + 1 }}
28
- </view>
29
-
30
- <view class="dev-tool-code-item-content" v-html="code"></view>
31
- </view>
32
- <Empty v-if="!codes || codes.length === 0" />
33
- </scroll-view>
23
+ <template #default="{ list, current, start }">
24
+ <AutoSize
25
+ v-for="(code, index) in list"
26
+ :key="start + index"
27
+ :index="start + index"
28
+ >
29
+ <view
30
+ :id="`dev-code-${start + index}`"
31
+ :class="`dev-tool-code-item ${start + index === activeRowCol.row ? 'dev-tool-code-item-active' : ''}`"
32
+ >
33
+ <view class="dev-tool-code-item-index">
34
+ {{ start + index + 1 }}
35
+ </view>
36
+
37
+ <view class="dev-tool-code-item-content">
38
+ {{ code }}
39
+ </view>
40
+ </view>
41
+ </AutoSize>
42
+ </template>
43
+ </VirtualListPro>
44
+ <Empty v-if="!codes || codes.length === 0" />
34
45
  </view>
35
46
  </template>
36
47
  <script lang="ts" setup>
37
- import { computed, ref, nextTick, onMounted } from 'vue';
48
+ import { computed, ref, onMounted } from 'vue';
38
49
  import FilterInput from '../FilterInput/index.vue';
39
50
  import CircularButton from '../CircularButton/index.vue';
51
+ import VirtualListPro from '../VirtualListPro/index.vue';
40
52
  import Empty from '../Empty/index.vue';
41
- import { escapeHTML, hightLight, isAndroid, parseStock } from '../../utils';
53
+ import AutoSize from '../VirtualListPro/AutoSize.vue';
54
+ import { hightLight, isAndroid, parseStock } from '../../utils';
42
55
 
43
56
  const props = defineProps<{
44
57
  url: string;
@@ -50,7 +63,7 @@ const props = defineProps<{
50
63
  const emit = defineEmits<{ (e: 'close'): void }>();
51
64
 
52
65
  const modelValue = ref('');
53
- const scrollTop = ref(0);
66
+ const height = ref(0);
54
67
  const fileName = computed(() => {
55
68
  const name =
56
69
  props?.url?.split('/')?.pop()?.replace(/\)|\(/, '') ?? '文件名称未知';
@@ -58,16 +71,13 @@ const fileName = computed(() => {
58
71
  });
59
72
 
60
73
  const activeRowCol = ref({ row: -1, col: -1, activeRow: -1 });
74
+ const scrollIntoView = ref('');
61
75
 
62
76
  let backupCodes: string[] = [];
63
77
 
64
78
  const codes = ref<string[]>([]);
65
-
66
- const scrollIntoView = ref('');
67
-
68
- const start = computed(() => {
69
- return activeRowCol.value.row - 20 > 0 ? activeRowCol.value.row - 20 : 0;
70
- });
79
+ const defaultCurrent = ref(1);
80
+ const pageSize = 25;
71
81
 
72
82
  function onClose() {
73
83
  emit('close');
@@ -79,6 +89,35 @@ function onSearch(value: string) {
79
89
  });
80
90
  }
81
91
 
92
+ let timer: number;
93
+ function startCounter({
94
+ start,
95
+ target,
96
+ duration,
97
+ onExecute,
98
+ onSuccess,
99
+ }: {
100
+ start: number;
101
+ target: number;
102
+ duration: number;
103
+ onExecute: (current: number) => void;
104
+ onSuccess: () => void;
105
+ }) {
106
+ if (timer) return;
107
+
108
+ let s = start;
109
+ timer = setInterval(() => {
110
+ if (s >= target) {
111
+ clearInterval(timer);
112
+ console.log('停止');
113
+ onSuccess();
114
+ return;
115
+ }
116
+ s++;
117
+ onExecute(s);
118
+ }, duration);
119
+ }
120
+
82
121
  let index = 0;
83
122
  function getCode(url: string, i: number = 0) {
84
123
  let allUrl = url;
@@ -100,34 +139,23 @@ function getCode(url: string, i: number = 0) {
100
139
  url: allUrl,
101
140
  success: (res) => {
102
141
  if (typeof res.data === 'string') {
103
- // 为什么要注释掉?
104
- // 在 Android 识别到标签后会进行重启,导致代码无法显示
105
- // TODO: 还有其它原因导致重启
106
- const str = res.data
107
- ?.replace(/<jscript/, '// [DevTool] 注释 <javascript')
108
- ?.replace(/<\/script>/, '// [DevTool] 注释 </javascript>')
109
- ?.replace(/<style/, '// [DevTool] 注释 <style')
110
- ?.replace(/<\/style>/, '// [DevTool] 注释 </style>');
111
- backupCodes = escapeHTML(str ?? '')
112
- .toString()
113
- .split('\n');
114
-
115
- const start =
116
- activeRowCol.value.row - 20 > 0 ? activeRowCol.value.row - 20 : 0;
117
-
118
- const end =
119
- activeRowCol.value.row + 20 > backupCodes.length
120
- ? backupCodes.length
121
- : activeRowCol.value.row + 20;
122
-
123
- // backupCodes.slice(start, end);
124
-
125
- codes.value = backupCodes.slice(start, end);
126
-
127
- activeRowCol.value.activeRow = activeRowCol.value.row - start;
128
-
129
- nextTick(() => {
130
- scrollIntoView.value = `dev-tool-code-item-${activeRowCol.value.activeRow}`;
142
+ codes.value = res.data?.split('\n') ?? [];
143
+
144
+ // 缓慢显示
145
+ const row = activeRowCol.value.row;
146
+ // defaultCurrent.value = Math.ceil(activeRowCol.value.row / pageSize);
147
+ const targetCurrent = Math.ceil(row / pageSize);
148
+
149
+ startCounter({
150
+ start: 1,
151
+ target: targetCurrent,
152
+ duration: 500,
153
+ onExecute(current) {
154
+ scrollIntoView.value = `dev-code-${current * pageSize - 1}`;
155
+ },
156
+ onSuccess() {
157
+ // scrollIntoView.value = `dev-code-${row}`;
158
+ },
131
159
  });
132
160
  }
133
161
  },
@@ -155,6 +183,10 @@ function getSourceCodeDev(url: string) {
155
183
  }
156
184
 
157
185
  onMounted(() => {
186
+ const { windowHeight } = uni.getWindowInfo();
187
+
188
+ height.value = windowHeight - 32 - 32 - 32;
189
+
158
190
  let url = props?.url;
159
191
 
160
192
  const { path, col, row } = parseStock(props?.url ?? '');
@@ -6,6 +6,7 @@
6
6
  :style="style"
7
7
  :scroll-into-view="innerScrollIntoView"
8
8
  scroll-y
9
+ :scrollX="scrollX"
9
10
  @scroll="onScroll"
10
11
  @scrolltolower="onScrollToLower"
11
12
  >
@@ -34,7 +35,7 @@
34
35
  </template>
35
36
  <script lang="ts" setup>
36
37
  import { nextTick } from 'vue';
37
- import { uniqueId } from '../../utils';
38
+ import { debounce, uniqueId } from '../../utils';
38
39
  import { reactive, watch, onBeforeMount, provide, computed, ref } from 'vue';
39
40
 
40
41
  const props = withDefaults(
@@ -59,11 +60,15 @@ const props = withDefaults(
59
60
  scrollWithAnimation?: boolean;
60
61
  /** 返回顶部 */
61
62
  showBackTop?: boolean;
63
+ /** 默认当前页 */
64
+ defaultCurrent?: number;
65
+ scrollX?: boolean;
62
66
  }>(),
63
67
  {
64
68
  height: 400,
65
69
  pageSize: 10,
66
70
  preLodeHeight: 50,
71
+ defaultCurrent: 1,
67
72
  },
68
73
  );
69
74
 
@@ -76,7 +81,7 @@ const state = reactive<{
76
81
  scrollTop: number;
77
82
  }>({
78
83
  height: 0,
79
- current: 0,
84
+ current: 1,
80
85
  visitableData: [],
81
86
  currentHeight: 0,
82
87
  scrollTop: 0,
@@ -106,14 +111,47 @@ const innerScrollIntoView = computed(() => {
106
111
 
107
112
  onBeforeMount(() => {
108
113
  // 初始渲染数据
109
- state.visitableData = props.data.slice(0, props.pageSize * 2);
114
+ state.visitableData = props.data.slice(
115
+ (props.defaultCurrent - 1) * props.pageSize,
116
+ props.pageSize * 2,
117
+ );
118
+
119
+ state.currentHeight = itemsHeight
120
+ .slice(0, (props.defaultCurrent - 1) * props.pageSize)
121
+ ?.reduce((acc, cur) => acc + cur, 0);
110
122
  });
111
123
 
112
124
  // 数据更新时重置
113
125
  watch(
114
- () => [props.data, props.pageSize],
126
+ () => [props.data, props.pageSize, props.defaultCurrent],
115
127
  () => {
116
- state.visitableData = props.data.slice(0, props.pageSize * 2);
128
+ // state.visitableData = props.data.slice(
129
+ // (props.defaultCurrent - 1) * props.pageSize,
130
+ // props.pageSize * 2,
131
+ // );
132
+
133
+ // console.log(' state.visitableData: ', state.visitableData);
134
+
135
+ // state.currentHeight = itemsHeight
136
+ // .slice(0, (props.defaultCurrent - 1) * props.pageSize)
137
+ // ?.reduce((acc, cur) => acc + cur, 0);
138
+
139
+ const { pageSize, data, defaultCurrent } = props;
140
+
141
+ // 计算新的起始和结束索引
142
+
143
+ const currentSub1 = defaultCurrent - 1 < 0 ? 0 : defaultCurrent - 1;
144
+ const currentAdd1 = defaultCurrent + 1;
145
+
146
+ const startIndex = currentSub1 * pageSize;
147
+ const endIndex = Math.min(currentAdd1 * pageSize, data.length);
148
+
149
+ // 更新可见数据
150
+ state.visitableData = data.slice(startIndex, endIndex);
151
+
152
+ state.currentHeight = itemsHeight
153
+ .slice(0, currentSub1 * pageSize)
154
+ ?.reduce((acc, cur) => acc + cur, 0);
117
155
  },
118
156
  );
119
157
 
@@ -136,8 +174,12 @@ function updateVisitableData() {
136
174
 
137
175
  /** 计算合并的高度 */
138
176
  function updateCurrentHeight() {
177
+ const { pageSize } = props;
178
+ const { current } = state;
179
+ const currentSub1 = current - 1 < 0 ? 0 : current - 1;
180
+
139
181
  const total = itemsHeight
140
- .slice(0, state.current * props.pageSize)
182
+ .slice(0, currentSub1 * pageSize)
141
183
  ?.reduce((acc, cur) => acc + cur, 0);
142
184
 
143
185
  state.currentHeight = total;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vite-uni-dev-tool",
3
- "version": "0.0.19",
3
+ "version": "0.0.20",
4
4
  "description": "vite-uni-dev-tool, debug, uni-app, 一处编写,到处调试",
5
5
  "keywords": [
6
6
  "vite",