wevu 1.0.0-alpha.1 → 1.0.0-alpha.3
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 +15 -4
- package/dist/compiler.cjs +17 -0
- package/dist/compiler.d.cts +17 -0
- package/dist/compiler.d.mts +17 -0
- package/dist/compiler.mjs +16 -0
- package/dist/index.cjs +232 -51
- package/dist/index.d.cts +201 -47
- package/dist/index.d.mts +201 -47
- package/dist/index.mjs +221 -52
- package/dist/{store-Cmw9vWBT.cjs → store-DTqmKv0w.cjs} +136 -13
- package/dist/{store-BcU7YVhB.mjs → store-YHZDsE3y.mjs} +101 -14
- package/dist/store.cjs +1 -1
- package/dist/store.d.cts +1 -1
- package/dist/store.d.mts +1 -1
- package/dist/store.mjs +1 -1
- package/package.json +15 -1
- /package/dist/{index-0dF4y5p6.d.mts → index-B63NgJPS.d.cts} +0 -0
- /package/dist/{index-DVEFI-Uo.d.cts → index-Bq83Mwxo.d.mts} +0 -0
package/dist/index.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as DefineStoreOptions, c as SubscriptionCallback, d as ref, f as unref, i as ActionSubscriber, l as Ref, n as createStore, o as MutationType, r as defineStore, s as StoreManager, t as storeToRefs, u as isRef } from "./index-
|
|
1
|
+
import { a as DefineStoreOptions, c as SubscriptionCallback, d as ref, f as unref, i as ActionSubscriber, l as Ref, n as createStore, o as MutationType, r as defineStore, s as StoreManager, t as storeToRefs, u as isRef } from "./index-B63NgJPS.cjs";
|
|
2
2
|
|
|
3
3
|
//#region src/reactivity/computed.d.ts
|
|
4
4
|
type ComputedGetter<T$1> = () => T$1;
|
|
@@ -30,9 +30,23 @@ interface ReactiveEffect<T$1 = any> {
|
|
|
30
30
|
deps: Dep[];
|
|
31
31
|
scheduler?: EffectScheduler;
|
|
32
32
|
active: boolean;
|
|
33
|
+
_running: boolean;
|
|
33
34
|
_fn: () => T$1;
|
|
34
35
|
onStop?: () => void;
|
|
35
36
|
}
|
|
37
|
+
declare function startBatch(): void;
|
|
38
|
+
declare function endBatch(): void;
|
|
39
|
+
declare function batch<T$1>(fn: () => T$1): T$1;
|
|
40
|
+
interface EffectScope {
|
|
41
|
+
active: boolean;
|
|
42
|
+
effects: ReactiveEffect[];
|
|
43
|
+
cleanups: (() => void)[];
|
|
44
|
+
run: <T$1>(fn: () => T$1) => T$1 | undefined;
|
|
45
|
+
stop: () => void;
|
|
46
|
+
}
|
|
47
|
+
declare function effectScope(detached?: boolean): EffectScope;
|
|
48
|
+
declare function getCurrentScope(): EffectScope | undefined;
|
|
49
|
+
declare function onScopeDispose(fn: () => void): void;
|
|
36
50
|
interface EffectOptions {
|
|
37
51
|
scheduler?: EffectScheduler;
|
|
38
52
|
lazy?: boolean;
|
|
@@ -46,7 +60,6 @@ declare function reactive<T$1 extends object>(target: T$1): T$1;
|
|
|
46
60
|
declare function isReactive(value: unknown): boolean;
|
|
47
61
|
declare function toRaw<T$1>(observed: T$1): T$1;
|
|
48
62
|
/**
|
|
49
|
-
* Establish a dependency on the whole reactive object "version".
|
|
50
63
|
* 让 effect 订阅整个对象的“版本号”,无需深度遍历即可对任何字段变化做出响应。
|
|
51
64
|
*/
|
|
52
65
|
declare function touchReactive(target: object): void;
|
|
@@ -66,7 +79,7 @@ declare function touchReactive(target: object): void;
|
|
|
66
79
|
*/
|
|
67
80
|
declare function shallowReactive<T$1 extends object>(target: T$1): T$1;
|
|
68
81
|
/**
|
|
69
|
-
*
|
|
82
|
+
* 判断一个值是否为 shallowReactive 创建的浅层响应式对象
|
|
70
83
|
*/
|
|
71
84
|
declare function isShallowReactive(value: unknown): boolean;
|
|
72
85
|
/**
|
|
@@ -206,6 +219,72 @@ type ComponentPublicInstance<D extends object, C extends ComputedDefinitions, M
|
|
|
206
219
|
interface MiniProgramAdapter {
|
|
207
220
|
setData?: (payload: Record<string, any>) => void | Promise<void>;
|
|
208
221
|
}
|
|
222
|
+
type MiniProgramComponentBehaviorOptions = WechatMiniprogram.Component.ComponentOptions;
|
|
223
|
+
type MpComponentOptions = WechatMiniprogram.Component.TrivialOption;
|
|
224
|
+
type MiniProgramBehaviorIdentifier = WechatMiniprogram.Behavior.BehaviorIdentifier | string;
|
|
225
|
+
interface MiniProgramComponentOptions {
|
|
226
|
+
/**
|
|
227
|
+
* 类似于 mixins/traits 的组件间代码复用机制(behaviors)。
|
|
228
|
+
*/
|
|
229
|
+
behaviors?: MiniProgramBehaviorIdentifier[];
|
|
230
|
+
/**
|
|
231
|
+
* 组件接受的外部样式类。
|
|
232
|
+
*/
|
|
233
|
+
externalClasses?: MpComponentOptions['externalClasses'];
|
|
234
|
+
/**
|
|
235
|
+
* 组件间关系定义。
|
|
236
|
+
*/
|
|
237
|
+
relations?: MpComponentOptions['relations'];
|
|
238
|
+
/**
|
|
239
|
+
* 组件数据字段监听器,用于监听 properties 和 data 的变化。
|
|
240
|
+
*/
|
|
241
|
+
observers?: MpComponentOptions['observers'];
|
|
242
|
+
/**
|
|
243
|
+
* 组件生命周期声明对象:
|
|
244
|
+
* `created`/`attached`/`ready`/`moved`/`detached`/`error`。
|
|
245
|
+
*
|
|
246
|
+
* 注意:wevu 会在 `attached/ready/detached/moved/error` 阶段做桥接与包装,
|
|
247
|
+
* 但 `created` 发生在 setup() 之前。
|
|
248
|
+
*/
|
|
249
|
+
lifetimes?: MpComponentOptions['lifetimes'];
|
|
250
|
+
/**
|
|
251
|
+
* 组件所在页面的生命周期声明对象:`show`/`hide`/`resize`/`routeDone`。
|
|
252
|
+
*/
|
|
253
|
+
pageLifetimes?: MpComponentOptions['pageLifetimes'];
|
|
254
|
+
/**
|
|
255
|
+
* 组件选项(multipleSlots/styleIsolation/pureDataPattern/virtualHost 等)。
|
|
256
|
+
*/
|
|
257
|
+
options?: MpComponentOptions['options'];
|
|
258
|
+
/**
|
|
259
|
+
* 定义段过滤器,用于自定义组件扩展。
|
|
260
|
+
*/
|
|
261
|
+
definitionFilter?: MpComponentOptions['definitionFilter'];
|
|
262
|
+
/**
|
|
263
|
+
* 组件自定义导出:当使用 `behavior: wx://component-export` 时,
|
|
264
|
+
* 可用于指定组件被 selectComponent 调用时的返回值。
|
|
265
|
+
*
|
|
266
|
+
* wevu 默认会将 setup() 中通过 `expose()` 写入的内容作为 export() 返回值,
|
|
267
|
+
* 因此大多数情况下无需手动编写 export();若同时提供 export(),则会与 expose() 结果浅合并。
|
|
268
|
+
*/
|
|
269
|
+
export?: MpComponentOptions['export'];
|
|
270
|
+
/**
|
|
271
|
+
* 原生 properties(与 wevu 的 props 不同)。
|
|
272
|
+
*
|
|
273
|
+
* - 推荐:使用 wevu 的 `props` 选项,让运行时规范化为小程序 `properties`。
|
|
274
|
+
* - 兼容:也可以直接传入小程序 `properties`。
|
|
275
|
+
*/
|
|
276
|
+
properties?: MpComponentOptions['properties'];
|
|
277
|
+
/**
|
|
278
|
+
* 旧式生命周期(基础库 `2.2.3` 起推荐使用 `lifetimes` 字段)。
|
|
279
|
+
* 保留以增强类型提示与兼容性。
|
|
280
|
+
*/
|
|
281
|
+
created?: MpComponentOptions['created'];
|
|
282
|
+
attached?: MpComponentOptions['attached'];
|
|
283
|
+
ready?: MpComponentOptions['ready'];
|
|
284
|
+
moved?: MpComponentOptions['moved'];
|
|
285
|
+
detached?: MpComponentOptions['detached'];
|
|
286
|
+
error?: MpComponentOptions['error'];
|
|
287
|
+
}
|
|
209
288
|
interface ModelBindingOptions<T$1 = any> {
|
|
210
289
|
event?: string;
|
|
211
290
|
valueProp?: string;
|
|
@@ -223,6 +302,7 @@ interface AppConfig {
|
|
|
223
302
|
type WevuPlugin = ((app: RuntimeApp<any, any, any>, ...options: any[]) => any) | {
|
|
224
303
|
install: (app: RuntimeApp<any, any, any>, ...options: any[]) => any;
|
|
225
304
|
};
|
|
305
|
+
type MiniProgramAppOptions<T$1 extends Record<string, any> = Record<string, any>> = WechatMiniprogram.App.Options<T$1>;
|
|
226
306
|
interface RuntimeApp<D extends object, C extends ComputedDefinitions, M extends MethodDefinitions> {
|
|
227
307
|
mount: (adapter?: MiniProgramAdapter) => RuntimeInstance<D, C, M>;
|
|
228
308
|
use: (plugin: WevuPlugin, ...options: any[]) => RuntimeApp<D, C, M>;
|
|
@@ -254,11 +334,11 @@ type ComponentPropsOptions = Record<string, PropOptions<any> | PropType<any> | n
|
|
|
254
334
|
interface PropOptions<T$1 = any> {
|
|
255
335
|
type?: PropType<T$1> | true | null;
|
|
256
336
|
/**
|
|
257
|
-
*
|
|
337
|
+
* 默认值(对齐 Vue 的 `default`;会被赋给小程序 property 的 `value`)
|
|
258
338
|
*/
|
|
259
339
|
default?: T$1 | (() => T$1);
|
|
260
340
|
/**
|
|
261
|
-
*
|
|
341
|
+
* 小程序 `value` 的别名
|
|
262
342
|
*/
|
|
263
343
|
value?: T$1 | (() => T$1);
|
|
264
344
|
required?: boolean;
|
|
@@ -283,73 +363,105 @@ type InferProps<P$1 extends ComponentPropsOptions = ComponentPropsOptions> = { [
|
|
|
283
363
|
type SetupFunction<P$1 extends ComponentPropsOptions, D extends object, C extends ComputedDefinitions, M extends MethodDefinitions> = (props: InferProps<P$1>, ctx: SetupContext<D, C, M, P$1>) => Record<string, any> | void;
|
|
284
364
|
interface SetupContext<D extends object, C extends ComputedDefinitions, M extends MethodDefinitions, P$1 extends ComponentPropsOptions = ComponentPropsOptions> {
|
|
285
365
|
/**
|
|
286
|
-
*
|
|
366
|
+
* 组件 props(来自小程序 properties)
|
|
287
367
|
*/
|
|
288
368
|
props: InferProps<P$1>;
|
|
289
369
|
/**
|
|
290
|
-
*
|
|
370
|
+
* 运行时实例
|
|
291
371
|
*/
|
|
292
372
|
runtime: RuntimeInstance<D, C, M>;
|
|
293
373
|
/**
|
|
294
|
-
*
|
|
374
|
+
* 响应式状态
|
|
295
375
|
*/
|
|
296
376
|
state: D;
|
|
297
377
|
/**
|
|
298
|
-
*
|
|
378
|
+
* 公开实例代理
|
|
299
379
|
*/
|
|
300
380
|
proxy: ComponentPublicInstance<D, C, M>;
|
|
301
381
|
/**
|
|
302
|
-
*
|
|
382
|
+
* 双向绑定辅助方法
|
|
303
383
|
*/
|
|
304
384
|
bindModel: RuntimeInstance<D, C, M>['bindModel'];
|
|
305
385
|
/**
|
|
306
|
-
*
|
|
386
|
+
* watch 辅助方法
|
|
307
387
|
*/
|
|
308
388
|
watch: RuntimeInstance<D, C, M>['watch'];
|
|
309
389
|
/**
|
|
310
|
-
*
|
|
390
|
+
* 小程序内部实例
|
|
311
391
|
*/
|
|
312
392
|
instance: InternalRuntimeState;
|
|
313
393
|
/**
|
|
314
|
-
*
|
|
394
|
+
* 通过小程序 `triggerEvent(eventName, detail?, options?)` 派发事件。
|
|
395
|
+
*
|
|
396
|
+
* 注意:不同于 Vue 3 的 `emit(event, ...args)`,小程序事件只携带一个 `detail` 载荷;
|
|
397
|
+
* `options` 用于控制事件传播行为(`bubbles`/`composed`/`capturePhase`)。
|
|
315
398
|
*/
|
|
316
|
-
emit: (event: string,
|
|
399
|
+
emit: (event: string, detail?: any, options?: TriggerEventOptions) => void;
|
|
317
400
|
/**
|
|
318
|
-
* Vue 3
|
|
401
|
+
* Vue 3 对齐:expose 公共属性
|
|
319
402
|
*/
|
|
320
|
-
expose
|
|
403
|
+
expose: (exposed: Record<string, any>) => void;
|
|
321
404
|
/**
|
|
322
|
-
* Vue 3
|
|
405
|
+
* Vue 3 对齐:attrs(小程序场景兜底为空对象)
|
|
323
406
|
*/
|
|
324
|
-
attrs
|
|
407
|
+
attrs: Record<string, any>;
|
|
325
408
|
}
|
|
326
|
-
|
|
409
|
+
type TriggerEventOptions = WechatMiniprogram.Component.TriggerEventOption;
|
|
410
|
+
interface InternalRuntimeStateFields {
|
|
327
411
|
__wevu?: RuntimeInstance<any, any, any>;
|
|
328
412
|
__wevuWatchStops?: WatchStopHandle[];
|
|
329
413
|
$wevu?: RuntimeInstance<any, any, any>;
|
|
330
414
|
__wevuHooks?: Record<string, any>;
|
|
331
415
|
__wevuExposed?: Record<string, any>;
|
|
332
416
|
}
|
|
333
|
-
|
|
417
|
+
type MiniProgramInstance = WechatMiniprogram.Component.TrivialInstance | WechatMiniprogram.Page.TrivialInstance | WechatMiniprogram.App.TrivialInstance;
|
|
418
|
+
type InternalRuntimeState = InternalRuntimeStateFields & Partial<MiniProgramInstance>;
|
|
419
|
+
type MiniProgramPageLifetimes = Partial<WechatMiniprogram.Page.ILifetime>;
|
|
420
|
+
type MiniProgramComponentRawOptions = Omit<WechatMiniprogram.Component.TrivialOption, 'behaviors'> & {
|
|
421
|
+
behaviors?: MiniProgramBehaviorIdentifier[];
|
|
422
|
+
} & MiniProgramPageLifetimes & Record<string, any>;
|
|
423
|
+
interface DefineComponentOptions<P$1 extends ComponentPropsOptions = ComponentPropsOptions, D extends object = Record<string, any>, C extends ComputedDefinitions = ComputedDefinitions, M extends MethodDefinitions = MethodDefinitions> extends MiniProgramComponentOptions, MiniProgramPageLifetimes {
|
|
334
424
|
/**
|
|
335
|
-
* Page
|
|
336
|
-
*
|
|
425
|
+
* 页面特性开关(用于按需注入 Page 事件处理函数)。
|
|
426
|
+
*
|
|
427
|
+
* 说明:小程序的部分页面事件/菜单项具有“按需派发/按需展示”特性,
|
|
428
|
+
* 只有定义了对应的 `onXXX` 方法才会触发/展示(如 `onPageScroll`、`onShareTimeline`)。
|
|
429
|
+
* 因此 wevu 需要在注册阶段(Component())就决定是否注入这些 onXXX。
|
|
430
|
+
*
|
|
431
|
+
* - 若你在 options 中显式定义了原生 `onXXX`,wevu 会自动桥接对应 hook(无需 features)。
|
|
432
|
+
* - 若你只想在 `setup()` 里使用 wevu hook(不额外写原生 `onXXX`),则通过 `features` 显式开启注入。
|
|
337
433
|
*/
|
|
338
434
|
features?: PageFeatures;
|
|
339
435
|
/**
|
|
340
|
-
* Vue
|
|
436
|
+
* 类 Vue 的 props 定义(会被规范化为小程序 `properties`)
|
|
341
437
|
*/
|
|
342
438
|
props?: P$1;
|
|
343
439
|
watch?: Record<string, any>;
|
|
344
440
|
setup?: SetupFunction<P$1, D, C, M>;
|
|
441
|
+
/**
|
|
442
|
+
* 组件 data(建议使用函数返回初始值)。
|
|
443
|
+
*/
|
|
444
|
+
data?: () => D;
|
|
445
|
+
/**
|
|
446
|
+
* 组件 computed(会参与快照 diff)。
|
|
447
|
+
*/
|
|
448
|
+
computed?: C;
|
|
449
|
+
/**
|
|
450
|
+
* 组件 methods(会绑定到 public instance 上)。
|
|
451
|
+
*/
|
|
452
|
+
methods?: M;
|
|
453
|
+
/**
|
|
454
|
+
* 透传/扩展字段:允许携带其他小程序原生 Component 选项或自定义字段。
|
|
455
|
+
* 说明:为保持兼容性保留 index signature,但仍会对已知字段提供智能提示。
|
|
456
|
+
*/
|
|
345
457
|
[key: string]: any;
|
|
346
458
|
}
|
|
347
|
-
interface DefineAppOptions<D extends object = Record<string, any>, C extends ComputedDefinitions = ComputedDefinitions, M extends MethodDefinitions = MethodDefinitions> {
|
|
459
|
+
interface DefineAppOptions<D extends object = Record<string, any>, C extends ComputedDefinitions = ComputedDefinitions, M extends MethodDefinitions = MethodDefinitions> extends MiniProgramAppOptions {
|
|
348
460
|
watch?: Record<string, any>;
|
|
349
461
|
setup?: (ctx: SetupContext<D, C, M>) => Record<string, any> | void;
|
|
350
462
|
[key: string]: any;
|
|
351
463
|
}
|
|
352
|
-
interface CreateAppOptions<D extends object = Record<string, any>, C extends ComputedDefinitions = ComputedDefinitions, M extends MethodDefinitions = MethodDefinitions> {
|
|
464
|
+
interface CreateAppOptions<D extends object = Record<string, any>, C extends ComputedDefinitions = ComputedDefinitions, M extends MethodDefinitions = MethodDefinitions> extends MiniProgramAppOptions {
|
|
353
465
|
data?: () => D;
|
|
354
466
|
computed?: C;
|
|
355
467
|
methods?: M;
|
|
@@ -358,10 +470,46 @@ interface CreateAppOptions<D extends object = Record<string, any>, C extends Com
|
|
|
358
470
|
[key: string]: any;
|
|
359
471
|
}
|
|
360
472
|
interface PageFeatures {
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
473
|
+
/**
|
|
474
|
+
* 启用页面滚动事件(注入 `onPageScroll`)。
|
|
475
|
+
*/
|
|
476
|
+
enableOnPageScroll?: boolean;
|
|
477
|
+
/**
|
|
478
|
+
* 启用下拉刷新事件(注入 `onPullDownRefresh`;仍需在页面配置开启 enablePullDownRefresh)。
|
|
479
|
+
*/
|
|
480
|
+
enableOnPullDownRefresh?: boolean;
|
|
481
|
+
/**
|
|
482
|
+
* 启用触底事件(注入 `onReachBottom`)。
|
|
483
|
+
*/
|
|
484
|
+
enableOnReachBottom?: boolean;
|
|
485
|
+
/**
|
|
486
|
+
* 启用路由动画完成事件(注入 `onRouteDone`)。
|
|
487
|
+
*/
|
|
488
|
+
enableOnRouteDone?: boolean;
|
|
489
|
+
/**
|
|
490
|
+
* 启用 Tab 点击事件(注入 `onTabItemTap`)。
|
|
491
|
+
*/
|
|
492
|
+
enableOnTabItemTap?: boolean;
|
|
493
|
+
/**
|
|
494
|
+
* 启用窗口尺寸变化事件(注入 `onResize`)。
|
|
495
|
+
*/
|
|
496
|
+
enableOnResize?: boolean;
|
|
497
|
+
/**
|
|
498
|
+
* 启用“转发/分享给朋友”(注入 `onShareAppMessage`,使右上角菜单显示“转发”)。
|
|
499
|
+
*/
|
|
500
|
+
enableOnShareAppMessage?: boolean;
|
|
501
|
+
/**
|
|
502
|
+
* 启用“分享到朋友圈”(注入 `onShareTimeline`,使右上角菜单显示“分享到朋友圈”)。
|
|
503
|
+
*/
|
|
504
|
+
enableOnShareTimeline?: boolean;
|
|
505
|
+
/**
|
|
506
|
+
* 启用“收藏”(注入 `onAddToFavorites`)。
|
|
507
|
+
*/
|
|
508
|
+
enableOnAddToFavorites?: boolean;
|
|
509
|
+
/**
|
|
510
|
+
* 启用“退出状态保存”(注入 `onSaveExitState`)。
|
|
511
|
+
*/
|
|
512
|
+
enableOnSaveExitState?: boolean;
|
|
365
513
|
}
|
|
366
514
|
//#endregion
|
|
367
515
|
//#region src/runtime/app.d.ts
|
|
@@ -387,8 +535,7 @@ interface ComponentDefinition<D extends object, C extends ComputedDefinitions, M
|
|
|
387
535
|
methods: M;
|
|
388
536
|
watch: Record<string, any> | undefined;
|
|
389
537
|
setup: DefineComponentOptions<ComponentPropsOptions, D, C, M>['setup'];
|
|
390
|
-
mpOptions:
|
|
391
|
-
features?: DefineComponentOptions<ComponentPropsOptions, D, C, M>['features'];
|
|
538
|
+
mpOptions: MiniProgramComponentRawOptions;
|
|
392
539
|
};
|
|
393
540
|
}
|
|
394
541
|
/**
|
|
@@ -412,7 +559,6 @@ interface ComponentDefinition<D extends object, C extends ComputedDefinitions, M
|
|
|
412
559
|
* @example
|
|
413
560
|
* ```ts
|
|
414
561
|
* defineComponent({
|
|
415
|
-
* features: { listenPageScroll: true },
|
|
416
562
|
* setup() {
|
|
417
563
|
* onPageScroll(() => {})
|
|
418
564
|
* }
|
|
@@ -426,28 +572,34 @@ declare function defineComponent<P$1 extends ComponentPropsOptions = ComponentPr
|
|
|
426
572
|
* @param options 组件选项,可能包含小程序特有的 properties
|
|
427
573
|
*/
|
|
428
574
|
declare function createWevuComponent<D extends object, C extends ComputedDefinitions, M extends MethodDefinitions>(options: DefineComponentOptions<ComponentPropsOptions, D, C, M> & {
|
|
429
|
-
properties?:
|
|
575
|
+
properties?: WechatMiniprogram.Component.PropertyOption;
|
|
430
576
|
}): void;
|
|
431
577
|
//#endregion
|
|
432
578
|
//#region src/runtime/hooks.d.ts
|
|
433
|
-
declare function getCurrentInstance():
|
|
579
|
+
declare function getCurrentInstance<T$1 extends InternalRuntimeState = InternalRuntimeState>(): T$1 | undefined;
|
|
434
580
|
declare function setCurrentInstance(inst: InternalRuntimeState | undefined): void;
|
|
435
581
|
declare function callHookList(target: InternalRuntimeState, name: string, args?: any[]): void;
|
|
436
582
|
declare function callHookReturn(target: InternalRuntimeState, name: string, args?: any[]): any;
|
|
437
|
-
declare function onAppShow(handler: () => void): void;
|
|
583
|
+
declare function onAppShow(handler: (options: WechatMiniprogram.App.LaunchShowOption) => void): void;
|
|
438
584
|
declare function onAppHide(handler: () => void): void;
|
|
439
|
-
declare function onAppError(handler: (
|
|
585
|
+
declare function onAppError(handler: (error: string) => void): void;
|
|
440
586
|
declare function onShow(handler: () => void): void;
|
|
587
|
+
declare function onLoad(handler: WechatMiniprogram.Page.ILifetime['onLoad']): void;
|
|
441
588
|
declare function onHide(handler: () => void): void;
|
|
442
589
|
declare function onUnload(handler: () => void): void;
|
|
443
590
|
declare function onReady(handler: () => void): void;
|
|
444
|
-
declare function
|
|
445
|
-
declare function
|
|
446
|
-
declare function
|
|
447
|
-
declare function
|
|
448
|
-
declare function
|
|
449
|
-
declare function
|
|
450
|
-
declare function
|
|
591
|
+
declare function onPullDownRefresh(handler: WechatMiniprogram.Page.ILifetime['onPullDownRefresh']): void;
|
|
592
|
+
declare function onReachBottom(handler: WechatMiniprogram.Page.ILifetime['onReachBottom']): void;
|
|
593
|
+
declare function onPageScroll(handler: (opt: WechatMiniprogram.Page.IPageScrollOption) => void): void;
|
|
594
|
+
declare function onRouteDone(handler: WechatMiniprogram.Page.ILifetime['onRouteDone'] | ((opt?: unknown) => void)): void;
|
|
595
|
+
declare function onTabItemTap(handler: (opt: WechatMiniprogram.Page.ITabItemTapOption) => void): void;
|
|
596
|
+
declare function onResize(handler: (opt: WechatMiniprogram.Page.IResizeOption) => void): void;
|
|
597
|
+
declare function onMoved(handler: () => void): void;
|
|
598
|
+
declare function onError(handler: (err: any) => void): void;
|
|
599
|
+
declare function onSaveExitState(handler: () => WechatMiniprogram.Page.ISaveExitState): void;
|
|
600
|
+
declare function onShareAppMessage(handler: WechatMiniprogram.Page.ILifetime['onShareAppMessage']): void;
|
|
601
|
+
declare function onShareTimeline(handler: WechatMiniprogram.Page.ILifetime['onShareTimeline']): void;
|
|
602
|
+
declare function onAddToFavorites(handler: WechatMiniprogram.Page.ILifetime['onAddToFavorites']): void;
|
|
451
603
|
/**
|
|
452
604
|
* Vue 3 对齐:组件/页面已挂载,映射小程序 onReady
|
|
453
605
|
*/
|
|
@@ -546,9 +698,11 @@ type WatchDescriptor = WatchHandler | string | {
|
|
|
546
698
|
};
|
|
547
699
|
type WatchMap = Record<string, WatchDescriptor>;
|
|
548
700
|
declare function runSetupFunction(setup: ((...args: any[]) => any) | undefined, props: Record<string, any>, context: any): any;
|
|
549
|
-
declare function mountRuntimeInstance<D extends object, C extends ComputedDefinitions, M extends MethodDefinitions>(target: InternalRuntimeState, runtimeApp: RuntimeApp<D, C, M>, watchMap: WatchMap | undefined, setup?: DefineComponentOptions<ComponentPropsOptions, D, C, M>['setup']
|
|
701
|
+
declare function mountRuntimeInstance<D extends object, C extends ComputedDefinitions, M extends MethodDefinitions>(target: InternalRuntimeState, runtimeApp: RuntimeApp<D, C, M>, watchMap: WatchMap | undefined, setup?: DefineComponentOptions<ComponentPropsOptions, D, C, M>['setup'], options?: {
|
|
702
|
+
deferSetData?: boolean;
|
|
703
|
+
}): RuntimeInstance<D, C, M>;
|
|
550
704
|
declare function teardownRuntimeInstance(target: InternalRuntimeState): void;
|
|
551
|
-
declare function registerApp<D extends object, C extends ComputedDefinitions, M extends MethodDefinitions>(runtimeApp: RuntimeApp<D, C, M>, methods: MethodDefinitions, watch: WatchMap | undefined, setup: DefineAppOptions<D, C, M>['setup'], mpOptions:
|
|
552
|
-
declare function registerComponent<D extends object, C extends ComputedDefinitions, M extends MethodDefinitions>(runtimeApp: RuntimeApp<D, C, M>, methods: MethodDefinitions, watch: WatchMap | undefined, setup: DefineComponentOptions<ComponentPropsOptions, D, C, M>['setup'], mpOptions:
|
|
705
|
+
declare function registerApp<D extends object, C extends ComputedDefinitions, M extends MethodDefinitions>(runtimeApp: RuntimeApp<D, C, M>, methods: MethodDefinitions, watch: WatchMap | undefined, setup: DefineAppOptions<D, C, M>['setup'], mpOptions: MiniProgramAppOptions): void;
|
|
706
|
+
declare function registerComponent<D extends object, C extends ComputedDefinitions, M extends MethodDefinitions>(runtimeApp: RuntimeApp<D, C, M>, methods: MethodDefinitions, watch: WatchMap | undefined, setup: DefineComponentOptions<ComponentPropsOptions, D, C, M>['setup'], mpOptions: MiniProgramComponentRawOptions): void;
|
|
553
707
|
//#endregion
|
|
554
|
-
export { ActionSubscriber, AppConfig, ComponentDefinition, ComponentPropsOptions, ComponentPublicInstance, ComputedDefinitions, ComputedGetter, ComputedRef, ComputedSetter, CreateAppOptions, DefineAppOptions, DefineComponentOptions, DefineStoreOptions, ExtractComputed, ExtractMethods, InferPropType, InferProps, InternalRuntimeState, MethodDefinitions, MiniProgramAdapter, ModelBinding, ModelBindingOptions, MutationType, PageFeatures, PropConstructor, PropOptions, PropType, Ref, RuntimeApp, RuntimeInstance, SetupContext, SetupFunction, StoreManager, SubscriptionCallback, ToRefs, WatchOptions, WatchStopHandle, WevuPlugin, WritableComputedOptions, WritableComputedRef, callHookList, callHookReturn, callUpdateHooks, computed, createApp, createStore, createWevuComponent, defineComponent, defineStore, effect, getCurrentInstance, getDeepWatchStrategy, inject, injectGlobal, isRaw, isReactive, isRef, isShallowReactive, isShallowRef, markRaw, mountRuntimeInstance, nextTick, onActivated, onAddToFavorites, onAppError, onAppHide, onAppShow, onBeforeMount, onBeforeUnmount, onBeforeUpdate, onDeactivated, onErrorCaptured, onHide, onMounted, onPageScroll, onReady, onRouteDone, onSaveExitState, onServerPrefetch, onShareAppMessage, onShareTimeline, onShow, onTabItemTap, onUnload, onUnmounted, onUpdated, provide, provideGlobal, reactive, readonly, ref, registerApp, registerComponent, runSetupFunction, setCurrentInstance, setDeepWatchStrategy, shallowReactive, shallowRef, stop, storeToRefs, teardownRuntimeInstance, toRaw, toRef, toRefs, touchReactive, traverse, triggerRef, unref, watch, watchEffect };
|
|
708
|
+
export { ActionSubscriber, AppConfig, ComponentDefinition, ComponentPropsOptions, ComponentPublicInstance, ComputedDefinitions, ComputedGetter, ComputedRef, ComputedSetter, CreateAppOptions, DefineAppOptions, DefineComponentOptions, DefineStoreOptions, EffectScope, ExtractComputed, ExtractMethods, InferPropType, InferProps, InternalRuntimeState, InternalRuntimeStateFields, MethodDefinitions, MiniProgramAdapter, MiniProgramAppOptions, MiniProgramBehaviorIdentifier, MiniProgramComponentBehaviorOptions, MiniProgramComponentOptions, MiniProgramComponentRawOptions, MiniProgramInstance, MiniProgramPageLifetimes, ModelBinding, ModelBindingOptions, MutationType, PageFeatures, PropConstructor, PropOptions, PropType, Ref, RuntimeApp, RuntimeInstance, SetupContext, SetupFunction, StoreManager, SubscriptionCallback, ToRefs, TriggerEventOptions, WatchOptions, WatchStopHandle, WevuPlugin, WritableComputedOptions, WritableComputedRef, batch, callHookList, callHookReturn, callUpdateHooks, computed, createApp, createStore, createWevuComponent, defineComponent, defineStore, effect, effectScope, endBatch, getCurrentInstance, getCurrentScope, getDeepWatchStrategy, inject, injectGlobal, isRaw, isReactive, isRef, isShallowReactive, isShallowRef, markRaw, mountRuntimeInstance, nextTick, onActivated, onAddToFavorites, onAppError, onAppHide, onAppShow, onBeforeMount, onBeforeUnmount, onBeforeUpdate, onDeactivated, onError, onErrorCaptured, onHide, onLoad, onMounted, onMoved, onPageScroll, onPullDownRefresh, onReachBottom, onReady, onResize, onRouteDone, onSaveExitState, onScopeDispose, onServerPrefetch, onShareAppMessage, onShareTimeline, onShow, onTabItemTap, onUnload, onUnmounted, onUpdated, provide, provideGlobal, reactive, readonly, ref, registerApp, registerComponent, runSetupFunction, setCurrentInstance, setDeepWatchStrategy, shallowReactive, shallowRef, startBatch, stop, storeToRefs, teardownRuntimeInstance, toRaw, toRef, toRefs, touchReactive, traverse, triggerRef, unref, watch, watchEffect };
|