lyb-js 1.6.9 → 1.6.11

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.
@@ -1,4 +1,4 @@
1
- /** @description 递归将JSON字符串深度解析为对象(安全版,支持循环引用检测)
1
+ /** @description 递归将JSON字符串深度解析为对象
2
2
  * @link 使用方法:https://www.npmjs.com/package/lyb-js#LibJsDeepJSONParse-深度解析JSON
3
3
  */
4
- export declare const libJsDeepJSONParse: <T>(data: any, seen?: WeakSet<object>) => T;
4
+ export declare const libJsDeepJSONParse: (data: any) => any;
@@ -1,31 +1,30 @@
1
- /** @description 递归将JSON字符串深度解析为对象(安全版,支持循环引用检测)
1
+ /** @description 递归将JSON字符串深度解析为对象
2
2
  * @link 使用方法:https://www.npmjs.com/package/lyb-js#LibJsDeepJSONParse-深度解析JSON
3
3
  */
4
- export const libJsDeepJSONParse = (data, seen = new WeakSet()) => {
5
- // 检查是否为字符串并尝试解析(仅在可能是JSON时才解析)
6
- if (typeof data === "string" && /^[\[{]/.test(data.trim())) {
7
- try {
8
- const parsed = JSON.parse(data);
9
- return libJsDeepJSONParse(parsed, seen);
4
+ export const libJsDeepJSONParse = (data) => {
5
+ // 检查是否为字符串并尝试解析
6
+ if (typeof data === "string") {
7
+ const trimmed = data.trim();
8
+ // 仅当字符串看起来是对象或数组时才尝试解析
9
+ if ((trimmed.startsWith("{") && trimmed.endsWith("}")) ||
10
+ (trimmed.startsWith("[") && trimmed.endsWith("]"))) {
11
+ try {
12
+ return libJsDeepJSONParse(JSON.parse(trimmed));
13
+ }
14
+ catch (_a) {
15
+ return data; // 如果解析失败,返回原始字符串
16
+ }
10
17
  }
11
- catch (_a) {
12
- return data;
13
- }
14
- }
15
- // 循环引用检测
16
- if (data !== null && typeof data === "object") {
17
- if (seen.has(data))
18
- return data;
19
- seen.add(data);
18
+ return data; // 非 JSON 字符串直接返回
20
19
  }
21
20
  // 如果是数组,递归处理每个元素
22
21
  if (Array.isArray(data)) {
23
- return data.map((item) => libJsDeepJSONParse(item, seen));
22
+ return data.map((item) => libJsDeepJSONParse(item));
24
23
  }
25
24
  // 如果是对象,递归处理每个属性值
26
25
  if (data !== null && typeof data === "object") {
27
- return Object.entries(data).reduce((acc, [key, value]) => {
28
- acc[key] = libJsDeepJSONParse(value, seen);
26
+ return Object.keys(data).reduce((acc, key) => {
27
+ acc[key] = libJsDeepJSONParse(data[key]);
29
28
  return acc;
30
29
  }, {});
31
30
  }
@@ -0,0 +1,21 @@
1
+ import { LibJsClassObservable } from "./LibJsClassObservable";
2
+ interface PullUpLoadObservable {
3
+ /** 当前加载状态文案 */
4
+ statusText: string;
5
+ /** 加载状态 */
6
+ loadStatus: "idle" | "loading" | "noMore" | "empty";
7
+ }
8
+ interface PullUpLoadParams {
9
+ /** 滚动容器 */
10
+ scrollEl: HTMLElement;
11
+ /** 加载状态元素 */
12
+ loadStatusEl: HTMLElement;
13
+ /** 触发加载回调 */
14
+ onLoad: () => void;
15
+ }
16
+ /** @description 上拉加载 */
17
+ export declare class LibJsPullUpLoad extends LibJsClassObservable<PullUpLoadObservable> {
18
+ constructor(params: PullUpLoadParams);
19
+ private checkAutoLoad;
20
+ }
21
+ export {};
@@ -0,0 +1,47 @@
1
+ import { LibJsClassObservable } from "./LibJsClassObservable";
2
+ /** @description 上拉加载 */
3
+ export class LibJsPullUpLoad extends LibJsClassObservable {
4
+ constructor(params) {
5
+ super({
6
+ statusText: "加载中...",
7
+ loadStatus: "idle",
8
+ });
9
+ const { scrollEl, loadStatusEl, onLoad } = params;
10
+ this.checkAutoLoad(onLoad, scrollEl);
11
+ this.onValue("loadStatus", (v) => {
12
+ if (v === "idle") {
13
+ this.checkAutoLoad(onLoad, scrollEl);
14
+ }
15
+ });
16
+ /** @description 滚动触发 */
17
+ scrollEl.addEventListener("scroll", () => {
18
+ //如果所有数据已加载完毕,则不再触发加载
19
+ if (["noMore", "empty", "loading"].includes(this.getValue("loadStatus")))
20
+ return;
21
+ const y = scrollEl.scrollTop;
22
+ //获取距离加载触发像素值
23
+ const loadDistance = scrollEl.scrollHeight -
24
+ scrollEl.clientHeight -
25
+ y -
26
+ loadStatusEl.offsetHeight;
27
+ if (loadDistance <= 0) {
28
+ this.setValue("loadStatus", "loading");
29
+ this.setValue("statusText", "加载中...");
30
+ setTimeout(() => {
31
+ onLoad();
32
+ }, 500);
33
+ }
34
+ });
35
+ }
36
+ // 1. 新增方法
37
+ checkAutoLoad(onLoad, scrollEl) {
38
+ if (!["noMore", "empty", "loading"].includes(this.getValue("loadStatus")) &&
39
+ scrollEl.scrollHeight <= scrollEl.clientHeight) {
40
+ this.setValue("loadStatus", "loading");
41
+ this.setValue("statusText", "加载中...");
42
+ setTimeout(() => {
43
+ onLoad();
44
+ }, 500);
45
+ }
46
+ }
47
+ }
package/libJs.d.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  import { LibJsNumberStepper } from "./Misc/LibJsNumberStepper";
2
2
  import { LibJsClassObservable } from "./Misc/LibJsClassObservable";
3
3
  import { LibJsResizeWatcher } from "./Base/LibJsResizeWatcher";
4
+ import { LibJsPullUpLoad } from "./Misc/LibJsPullUpLoad";
4
5
  /** @description 基础方法 */
5
6
  export declare const Base: {
6
7
  /**
@@ -78,7 +79,7 @@ export declare const Data: {
78
79
  /** @description 递归将JSON字符串深度解析为对象
79
80
  * @link 使用方法:https://www.npmjs.com/package/lyb-js#LibJsDeepJSONParse-深度解析JSON
80
81
  */
81
- libJsDeepJSONParse: <T>(data: any, seen?: WeakSet<object>) => T;
82
+ libJsDeepJSONParse: (data: any) => any;
82
83
  /**
83
84
  * @description 分类汇总,将数组对象按照指定键值整理成一个以键值为键名的对象
84
85
  * @param arr 要分组的数组
@@ -278,6 +279,8 @@ export declare const Misc: {
278
279
  * @link 使用方法:https://www.npmjs.com/package/lyb-js#LibJsClassObservable-类属性监听器
279
280
  */
280
281
  LibJsClassObservable: typeof LibJsClassObservable;
282
+ /** @description 上拉加载 */
283
+ LibJsPullUpLoad: typeof LibJsPullUpLoad;
281
284
  };
282
285
  /** @description 随机相关方法 */
283
286
  export declare const Random: {
package/libJs.js CHANGED
@@ -43,6 +43,7 @@ import { LibJsNormalizeInRange } from "./Math/LibJsNormalizeInRange";
43
43
  import { LibJsClassObservable } from "./Misc/LibJsClassObservable";
44
44
  import { libJsCopy } from "./Browser/LibJsCopy";
45
45
  import { LibJsResizeWatcher } from "./Base/LibJsResizeWatcher";
46
+ import { LibJsPullUpLoad } from "./Misc/LibJsPullUpLoad";
46
47
  /** @description 基础方法 */
47
48
  export const Base = {
48
49
  /**
@@ -290,6 +291,8 @@ export const Misc = {
290
291
  * @link 使用方法:https://www.npmjs.com/package/lyb-js#LibJsClassObservable-类属性监听器
291
292
  */
292
293
  LibJsClassObservable,
294
+ /** @description 上拉加载 */
295
+ LibJsPullUpLoad,
293
296
  };
294
297
  /** @description 随机相关方法 */
295
298
  export const Random = {
package/lyb.js CHANGED
@@ -133,31 +133,26 @@ ${log3.label}:`, log3.value];
133
133
  }
134
134
  return result;
135
135
  };
136
- const libJsDeepJSONParse = (data, seen = /* @__PURE__ */ new WeakSet()) => {
137
- if (typeof data === "string" && /^[\[{]/.test(data.trim())) {
138
- try {
139
- const parsed = JSON.parse(data);
140
- return libJsDeepJSONParse(parsed, seen);
141
- } catch {
142
- return data;
136
+ const libJsDeepJSONParse = (data) => {
137
+ if (typeof data === "string") {
138
+ const trimmed = data.trim();
139
+ if (trimmed.startsWith("{") && trimmed.endsWith("}") || trimmed.startsWith("[") && trimmed.endsWith("]")) {
140
+ try {
141
+ return libJsDeepJSONParse(JSON.parse(trimmed));
142
+ } catch {
143
+ return data;
144
+ }
143
145
  }
144
- }
145
- if (data !== null && typeof data === "object") {
146
- if (seen.has(data))
147
- return data;
148
- seen.add(data);
146
+ return data;
149
147
  }
150
148
  if (Array.isArray(data)) {
151
- return data.map((item) => libJsDeepJSONParse(item, seen));
149
+ return data.map((item) => libJsDeepJSONParse(item));
152
150
  }
153
151
  if (data !== null && typeof data === "object") {
154
- return Object.entries(data).reduce(
155
- (acc, [key, value]) => {
156
- acc[key] = libJsDeepJSONParse(value, seen);
157
- return acc;
158
- },
159
- {}
160
- );
152
+ return Object.keys(data).reduce((acc, key) => {
153
+ acc[key] = libJsDeepJSONParse(data[key]);
154
+ return acc;
155
+ }, {});
161
156
  }
162
157
  return data;
163
158
  };
@@ -313,10 +308,10 @@ ${log3.label}:`, log3.value];
313
308
  return distance;
314
309
  };
315
310
  /*!
316
- * decimal.js v10.4.3
311
+ * decimal.js v10.5.0
317
312
  * An arbitrary-precision Decimal type for JavaScript.
318
313
  * https://github.com/MikeMcl/decimal.js
319
- * Copyright (c) 2022 Michael Mclaughlin <M8ch88l@gmail.com>
314
+ * Copyright (c) 2025 Michael Mclaughlin <M8ch88l@gmail.com>
320
315
  * MIT Licence
321
316
  */
322
317
  var EXP_LIMIT = 9e15, MAX_DIGITS = 1e9, NUMERALS = "0123456789abcdef", LN10 = "2.3025850929940456840179914546843642076011014886287729760333279009675726096773524802359972050895982983419677840422862486334095254650828067566662873690987816894829072083255546808437998948262331985283935053089653777326288461633662222876982198867465436674744042432743651550489343149393914796194044002221051017141748003688084012647080685567743216228355220114804663715659121373450747856947683463616792101806445070648000277502684916746550586856935673420670581136429224554405758925724208241314695689016758940256776311356919292033376587141660230105703089634572075440370847469940168269282808481184289314848524948644871927809676271275775397027668605952496716674183485704422507197965004714951050492214776567636938662976979522110718264549734772662425709429322582798502585509785265383207606726317164309505995087807523710333101197857547331541421808427543863591778117054309827482385045648019095610299291824318237525357709750539565187697510374970888692180205189339507238539205144634197265287286965110862571492198849978748873771345686209167058", PI = "3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679821480865132823066470938446095505822317253594081284811174502841027019385211055596446229489549303819644288109756659334461284756482337867831652712019091456485669234603486104543266482133936072602491412737245870066063155881748815209209628292540917153643678925903600113305305488204665213841469519415116094330572703657595919530921861173819326117931051185480744623799627495673518857527248912279381830119491298336733624406566430860213949463952247371907021798609437027705392171762931767523846748184676694051320005681271452635608277857713427577896091736371787214684409012249534301465495853710507922796892589235420199561121290219608640344181598136297747713099605187072113499999983729780499510597317328160963185950244594553469083026425223082533446850352619311881710100031378387528865875332083814206171776691473035982534904287554687311595628638823537875937519577818577805321712268066130019278766111959092164201989380952572010654858632789", DEFAULTS = {
@@ -585,7 +580,7 @@ ${log3.label}:`, log3.value];
585
580
  return divide(x.sinh(), x.cosh(), Ctor.precision = pr, Ctor.rounding = rm);
586
581
  };
587
582
  P.inverseCosine = P.acos = function() {
588
- var halfPi, x = this, Ctor = x.constructor, k = x.abs().cmp(1), pr = Ctor.precision, rm = Ctor.rounding;
583
+ var x = this, Ctor = x.constructor, k = x.abs().cmp(1), pr = Ctor.precision, rm = Ctor.rounding;
589
584
  if (k !== -1) {
590
585
  return k === 0 ? x.isNeg() ? getPi(Ctor, pr, rm) : new Ctor(0) : new Ctor(NaN);
591
586
  }
@@ -593,11 +588,10 @@ ${log3.label}:`, log3.value];
593
588
  return getPi(Ctor, pr + 4, rm).times(0.5);
594
589
  Ctor.precision = pr + 6;
595
590
  Ctor.rounding = 1;
596
- x = x.asin();
597
- halfPi = getPi(Ctor, pr + 4, rm).times(0.5);
591
+ x = new Ctor(1).minus(x).div(x.plus(1)).sqrt().atan();
598
592
  Ctor.precision = pr;
599
593
  Ctor.rounding = rm;
600
- return halfPi.minus(x);
594
+ return x.times(2);
601
595
  };
602
596
  P.inverseHyperbolicCosine = P.acosh = function() {
603
597
  var pr, rm, x = this, Ctor = x.constructor;
@@ -1809,14 +1803,16 @@ ${log3.label}:`, log3.value];
1809
1803
  function isOdd(n) {
1810
1804
  return n.d[n.d.length - 1] & 1;
1811
1805
  }
1812
- function maxOrMin(Ctor, args, ltgt) {
1813
- var y, x = new Ctor(args[0]), i = 0;
1806
+ function maxOrMin(Ctor, args, n) {
1807
+ var k, y, x = new Ctor(args[0]), i = 0;
1814
1808
  for (; ++i < args.length; ) {
1815
1809
  y = new Ctor(args[i]);
1816
1810
  if (!y.s) {
1817
1811
  x = y;
1818
1812
  break;
1819
- } else if (x[ltgt](y)) {
1813
+ }
1814
+ k = x.cmp(y);
1815
+ if (k === n || k === 0 && x.s === n) {
1820
1816
  x = y;
1821
1817
  }
1822
1818
  }
@@ -2397,7 +2393,8 @@ ${log3.label}:`, log3.value];
2397
2393
  x.d = [v];
2398
2394
  }
2399
2395
  return;
2400
- } else if (v * 0 !== 0) {
2396
+ }
2397
+ if (v * 0 !== 0) {
2401
2398
  if (!v)
2402
2399
  x.s = NaN;
2403
2400
  x.e = NaN;
@@ -2405,18 +2402,28 @@ ${log3.label}:`, log3.value];
2405
2402
  return;
2406
2403
  }
2407
2404
  return parseDecimal(x, v.toString());
2408
- } else if (t !== "string") {
2409
- throw Error(invalidArgument + v);
2410
2405
  }
2411
- if ((i2 = v.charCodeAt(0)) === 45) {
2412
- v = v.slice(1);
2413
- x.s = -1;
2414
- } else {
2415
- if (i2 === 43)
2406
+ if (t === "string") {
2407
+ if ((i2 = v.charCodeAt(0)) === 45) {
2416
2408
  v = v.slice(1);
2417
- x.s = 1;
2409
+ x.s = -1;
2410
+ } else {
2411
+ if (i2 === 43)
2412
+ v = v.slice(1);
2413
+ x.s = 1;
2414
+ }
2415
+ return isDecimal.test(v) ? parseDecimal(x, v) : parseOther(x, v);
2418
2416
  }
2419
- return isDecimal.test(v) ? parseDecimal(x, v) : parseOther(x, v);
2417
+ if (t === "bigint") {
2418
+ if (v < 0) {
2419
+ v = -v;
2420
+ x.s = -1;
2421
+ } else {
2422
+ x.s = 1;
2423
+ }
2424
+ return parseDecimal(x, v.toString());
2425
+ }
2426
+ throw Error(invalidArgument + v);
2420
2427
  }
2421
2428
  Decimal2.prototype = P;
2422
2429
  Decimal2.ROUND_UP = 0;
@@ -2526,10 +2533,10 @@ ${log3.label}:`, log3.value];
2526
2533
  return new this(x).log(10);
2527
2534
  }
2528
2535
  function max() {
2529
- return maxOrMin(this, arguments, "lt");
2536
+ return maxOrMin(this, arguments, -1);
2530
2537
  }
2531
2538
  function min() {
2532
- return maxOrMin(this, arguments, "gt");
2539
+ return maxOrMin(this, arguments, 1);
2533
2540
  }
2534
2541
  function mod(x, y) {
2535
2542
  return new this(x).mod(y);
@@ -3560,6 +3567,44 @@ ${log3.label}:`, log3.value];
3560
3567
  };
3561
3568
  }
3562
3569
  }
3570
+ class LibJsPullUpLoad extends LibJsClassObservable {
3571
+ constructor(params) {
3572
+ super({
3573
+ statusText: "加载中...",
3574
+ loadStatus: "idle"
3575
+ });
3576
+ const { scrollEl, loadStatusEl, onLoad } = params;
3577
+ this.checkAutoLoad(onLoad, scrollEl);
3578
+ this.onValue("loadStatus", (v) => {
3579
+ if (v === "idle") {
3580
+ this.checkAutoLoad(onLoad, scrollEl);
3581
+ }
3582
+ });
3583
+ scrollEl.addEventListener("scroll", () => {
3584
+ if (["noMore", "empty", "loading"].includes(this.getValue("loadStatus")))
3585
+ return;
3586
+ const y = scrollEl.scrollTop;
3587
+ const loadDistance = scrollEl.scrollHeight - scrollEl.clientHeight - y - loadStatusEl.offsetHeight;
3588
+ if (loadDistance <= 0) {
3589
+ this.setValue("loadStatus", "loading");
3590
+ this.setValue("statusText", "加载中...");
3591
+ setTimeout(() => {
3592
+ onLoad();
3593
+ }, 500);
3594
+ }
3595
+ });
3596
+ }
3597
+ // 1. 新增方法
3598
+ checkAutoLoad(onLoad, scrollEl) {
3599
+ if (!["noMore", "empty", "loading"].includes(this.getValue("loadStatus")) && scrollEl.scrollHeight <= scrollEl.clientHeight) {
3600
+ this.setValue("loadStatus", "loading");
3601
+ this.setValue("statusText", "加载中...");
3602
+ setTimeout(() => {
3603
+ onLoad();
3604
+ }, 500);
3605
+ }
3606
+ }
3607
+ }
3563
3608
  const Base = {
3564
3609
  /**
3565
3610
  * @description 返回数据类型
@@ -3799,7 +3844,9 @@ ${log3.label}:`, log3.value];
3799
3844
  /** @description 类属性监听器
3800
3845
  * @link 使用方法:https://www.npmjs.com/package/lyb-js#LibJsClassObservable-类属性监听器
3801
3846
  */
3802
- LibJsClassObservable
3847
+ LibJsClassObservable,
3848
+ /** @description 上拉加载 */
3849
+ LibJsPullUpLoad
3803
3850
  };
3804
3851
  const Random = {
3805
3852
  /** @description 百分比概率结果
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lyb-js",
3
- "version": "1.6.9",
3
+ "version": "1.6.11",
4
4
  "description": "自用JS方法库",
5
5
  "license": "ISC",
6
6
  "type": "module",
@@ -1,25 +0,0 @@
1
- type Callback<T> = (newValue: T[keyof T], oldValue: T[keyof T]) => void;
2
- export declare class LibJsObserver<Store> {
3
- /** 递增索引 */
4
- private _index;
5
- private _store;
6
- private _lastData;
7
- private _listeners;
8
- constructor(store: Store);
9
- /** @description 监听
10
- * @param key 要监听的键
11
- * @param callback key值变化时执行的回调函数
12
- * @param immediately 监听时是否立即执行回调函数
13
- * @returns 返回一个函数用于注销监听器
14
- */
15
- on(key: keyof Store, callback: Callback<Store>, immediately?: boolean): () => void;
16
- /** @description 获取数据 */
17
- getData(key: keyof Store): Store[keyof Store];
18
- /** @description 手动更新数据 */
19
- setData(newData: Partial<Store>): void;
20
- /** @description 通知监听器更新 */
21
- private _notifyListeners;
22
- /** @description 判断数据变化并通知监听器 */
23
- private _update;
24
- }
25
- export {};
@@ -1,100 +0,0 @@
1
- export class LibJsObserver {
2
- constructor(store) {
3
- /** 递增索引 */
4
- this._index = 0;
5
- // 监听器映射,用于存储不同键的回调函数
6
- this._listeners = new Map();
7
- this._store = store;
8
- this._lastData = Object.assign({}, store);
9
- }
10
- /** @description 监听
11
- * @param key 要监听的键
12
- * @param callback key值变化时执行的回调函数
13
- * @param immediately 监听时是否立即执行回调函数
14
- * @returns 返回一个函数用于注销监听器
15
- */
16
- on(key, callback, immediately = true) {
17
- this._index += 1;
18
- const index = this._index;
19
- // 如果该键没有对应的监听器集合,则初始化一个新的集合
20
- if (!this._listeners.has(key)) {
21
- this._listeners.set(key, new Map());
22
- }
23
- // 将回调函数添加到对应键的监听器集合中
24
- this._listeners.get(key).set(index, callback);
25
- immediately && callback(this._store[key], this._lastData[key]);
26
- return () => {
27
- // 从特定键的监听器集合中移除指定标识符的回调函数
28
- const listenerMap = this._listeners.get(key);
29
- if (listenerMap) {
30
- listenerMap.delete(index);
31
- }
32
- else {
33
- console.warn(`监听 Key "${key.toString()}" 重复注销事件`);
34
- }
35
- };
36
- }
37
- /** @description 获取数据 */
38
- getData(key) {
39
- return this._store[key];
40
- }
41
- /** @description 手动更新数据 */
42
- setData(newData) {
43
- this._store = Object.assign(Object.assign({}, this._store), newData);
44
- this._update();
45
- }
46
- /** @description 通知监听器更新 */
47
- _notifyListeners(key, newValue, oldValue) {
48
- // 获取特定键的所有监听器
49
- const keyListeners = this._listeners.get(key);
50
- if (keyListeners) {
51
- // 遍历并执行每个监听器的回调函数
52
- keyListeners.forEach((callback) => callback(newValue, oldValue));
53
- }
54
- }
55
- /** @description 判断数据变化并通知监听器 */
56
- _update() {
57
- // 遍历当前数据对象的每个键,检查是否有变化
58
- for (const key in this._store) {
59
- const typedKey = key;
60
- const newValue = this._store[typedKey];
61
- const oldValue = this._lastData[typedKey];
62
- //如果旧值与新值不相等,则通知监听器
63
- if (newValue !== oldValue) {
64
- this._notifyListeners(typedKey, newValue, oldValue);
65
- this._lastData[typedKey] = this._store[typedKey];
66
- }
67
- }
68
- }
69
- }
70
- class LibJsStore extends LibJsObserver {
71
- constructor() {
72
- super({
73
- name: "张三",
74
- age: 20,
75
- });
76
- }
77
- }
78
- const store = new LibJsStore();
79
- const offA = store.on("age", (newValue) => {
80
- console.log(`A收到年龄更新:`, newValue);
81
- });
82
- store.on("age", (newValue) => {
83
- console.log(`B收到年龄更新:`, newValue);
84
- });
85
- // 模拟更新数据
86
- setTimeout(() => {
87
- console.log("尝试更新年龄值为:25");
88
- store.setData({ age: 25 });
89
- setTimeout(() => {
90
- console.warn("注销A监听器");
91
- offA();
92
- setTimeout(() => {
93
- console.warn("尝试更新年龄值为:26");
94
- store.setData({ age: 26 });
95
- setTimeout(() => {
96
- console.log("尝试获取年龄值:", store.getData("age"));
97
- }, 1000);
98
- }, 1000);
99
- }, 1000);
100
- }, 1000);