@tarojs/runtime 3.6.9-alpha.13 → 3.6.9-alpha.15

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.
@@ -4,6 +4,7 @@ import { Style } from './style';
4
4
  import type { Attributes, Func } from '../interface';
5
5
  import type { TaroEvent } from './event';
6
6
  export declare class TaroElement extends TaroNode {
7
+ ctx?: any;
7
8
  tagName: string;
8
9
  props: Record<string, any>;
9
10
  style: Style;
@@ -6,6 +6,7 @@ import type { TaroElement } from '../dom/element';
6
6
  import type { Func, MpEvent } from '../interface';
7
7
  export interface Instance<T = Record<string, any>> extends Component<T>, Show, PageInstance {
8
8
  tid?: string;
9
+ node?: TaroElement;
9
10
  $forceUpdate?(): void;
10
11
  $nextTick?(cb: () => void): void;
11
12
  $options: Instance;
@@ -77,6 +78,7 @@ interface Show {
77
78
  export interface AppInstance extends Show {
78
79
  componentDidShow?(options?: Record<string, unknown>): void;
79
80
  mount?(component: React.ComponentClass | ComponentOptions<VueCtor> | Vue3Component, id: string, cb: (...args: any[]) => void): void;
81
+ mount?(component: React.ComponentClass | ComponentOptions<VueCtor> | Vue3Component, id: string, getCtx: (...args: any[]) => void, cb: (...args: any[]) => void): void;
80
82
  onError?(error: string): void;
81
83
  onLaunch?(options?: Record<string, unknown>): void;
82
84
  onPageNotFound?(res: any): void;
package/dist/index.d.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  import './dom-external';
2
+ import env from './env';
2
3
  export { hooks } from '@tarojs/shared';
3
4
  export { document } from './bom/document';
4
5
  export { getComputedStyle } from './bom/getComputedStyle';
@@ -18,9 +19,11 @@ export { Style } from './dom/style';
18
19
  export { SVGElement } from './dom/svg';
19
20
  export { TaroText } from './dom/text';
20
21
  export { MutationObserver } from './dom-external/mutation-observer';
22
+ export { env };
23
+ export * from './constants';
21
24
  export { Current, getCurrentInstance } from './current';
22
25
  export { eventSource } from './dom/event-source';
23
- export { addLeadingSlash, createComponentConfig, createPageConfig, createRecursiveComponentConfig, getPageInstance, getPath, injectPageInstance, removePageInstance, safeExecute, stringify } from './dsl/common';
26
+ export { addLeadingSlash, createComponentConfig, createPageConfig, createRecursiveComponentConfig, getOnHideEventKey, getOnReadyEventKey, getOnShowEventKey, getPageInstance, getPath, injectPageInstance, removePageInstance, safeExecute, stringify } from './dsl/common';
24
27
  export * from './emitter/emitter';
25
28
  export { hydrate } from './hydrate';
26
29
  export { nextTick } from './next-tick';
@@ -5,7 +5,6 @@ import { ComponentOptions, VNode } from "vue";
5
5
  import { Component as Vue3Component } from "@vue/runtime-core";
6
6
  import { Component, ComponentClass } from "react";
7
7
  import { CombinedVueInstance } from "vue/types/vue";
8
- declare let document: any;
9
8
  declare class ClassList {
10
9
  private el;
11
10
  private tokenList;
@@ -104,70 +103,6 @@ declare class TaroText extends TaroNode {
104
103
  set data(text: string);
105
104
  get data(): string;
106
105
  }
107
- // Taro 事件对象。以 Web 标准的事件对象为基础,加入小程序事件对象中携带的部分信息,并模拟实现事件冒泡。
108
- declare class TaroEvent {
109
- private cacheTarget;
110
- private cacheCurrentTarget;
111
- type: string;
112
- bubbles: boolean;
113
- cancelable: boolean;
114
- _stop: boolean;
115
- _end: boolean;
116
- defaultPrevented: boolean;
117
- // Mouse Event botton property, it's used in 3rd lib, like react-router. default 0 in general
118
- button: number;
119
- // timestamp can either be hi-res ( relative to page load) or low-res (relative to UNIX epoch)
120
- // here use hi-res timestamp
121
- timeStamp: number;
122
- mpEvent: MpEvent | undefined;
123
- constructor(type: string, opts: EventOptions, event?: MpEvent);
124
- stopPropagation(): void;
125
- stopImmediatePropagation(): void;
126
- preventDefault(): void;
127
- get target(): any;
128
- get currentTarget(): any;
129
- }
130
- declare function createEvent(event: MpEvent | string, node?: TaroElement): TaroEvent;
131
- // 小程序的事件代理回调函数
132
- declare function eventHandler(event: MpEvent): any;
133
- declare class FormElement extends TaroElement {
134
- get type(): string;
135
- set type(val: string);
136
- get value(): string | boolean | number | any[];
137
- set value(val: string | boolean | number | any[]);
138
- dispatchEvent(event: TaroEvent): boolean;
139
- }
140
- declare class TaroRootElement extends TaroElement {
141
- private updatePayloads;
142
- private updateCallbacks;
143
- pendingUpdate: boolean;
144
- ctx: null | MpInstance;
145
- constructor();
146
- get _path(): string;
147
- get _root(): TaroRootElement;
148
- enqueueUpdate(payload: UpdatePayload): void;
149
- performUpdate(initRender?: boolean, prerender?: Func): void;
150
- enqueueUpdateCallback(cb: Func, ctx?: Record<string, any>): void;
151
- flushUpdateCallback(): void;
152
- }
153
- declare class TaroDocument extends TaroElement {
154
- documentElement: TaroElement;
155
- head: TaroElement;
156
- body: TaroElement;
157
- createEvent: typeof createEvent;
158
- constructor();
159
- createElement(type: string): TaroElement | TaroRootElement | FormElement;
160
- // an ugly fake createElementNS to deal with @vue/runtime-dom's
161
- // support mounting app to svg container since vue@3.0.8
162
- createElementNS(_svgNS: string, type: string): TaroElement | TaroRootElement | FormElement;
163
- createTextNode(text: string): TaroText;
164
- getElementById<T extends TaroElement>(id: string | undefined | null): T | null;
165
- querySelector<T extends TaroElement>(query: string): T | null;
166
- querySelectorAll(): never[];
167
- // @TODO: @PERF: 在 hydrate 移除掉空的 node
168
- createComment(): TaroText;
169
- get defaultView(): any;
170
- }
171
106
  interface Node {
172
107
  type: string;
173
108
  }
@@ -207,6 +142,19 @@ declare class TaroEventTarget {
207
142
  removeEventListener(type: string, handler: EventHandler): void;
208
143
  isAnyEventBinded(): boolean;
209
144
  }
145
+ declare class TaroRootElement extends TaroElement {
146
+ private updatePayloads;
147
+ private updateCallbacks;
148
+ pendingUpdate: boolean;
149
+ ctx: null | MpInstance;
150
+ constructor();
151
+ get _path(): string;
152
+ get _root(): TaroRootElement;
153
+ enqueueUpdate(payload: UpdatePayload): void;
154
+ performUpdate(initRender?: boolean, prerender?: Func): void;
155
+ enqueueUpdateCallback(cb: Func, ctx?: Record<string, any>): void;
156
+ flushUpdateCallback(): void;
157
+ }
210
158
  interface RemoveChildOptions {
211
159
  cleanRef?: boolean;
212
160
  doUpdate?: boolean;
@@ -290,7 +238,34 @@ declare class Style {
290
238
  removeProperty(propertyName: string): string;
291
239
  getPropertyValue(propertyName: string): any;
292
240
  }
241
+ // Taro 事件对象。以 Web 标准的事件对象为基础,加入小程序事件对象中携带的部分信息,并模拟实现事件冒泡。
242
+ declare class TaroEvent {
243
+ private cacheTarget;
244
+ private cacheCurrentTarget;
245
+ type: string;
246
+ bubbles: boolean;
247
+ cancelable: boolean;
248
+ _stop: boolean;
249
+ _end: boolean;
250
+ defaultPrevented: boolean;
251
+ // Mouse Event botton property, it's used in 3rd lib, like react-router. default 0 in general
252
+ button: number;
253
+ // timestamp can either be hi-res ( relative to page load) or low-res (relative to UNIX epoch)
254
+ // here use hi-res timestamp
255
+ timeStamp: number;
256
+ mpEvent: MpEvent | undefined;
257
+ constructor(type: string, opts: EventOptions, event?: MpEvent);
258
+ stopPropagation(): void;
259
+ stopImmediatePropagation(): void;
260
+ preventDefault(): void;
261
+ get target(): any;
262
+ get currentTarget(): any;
263
+ }
264
+ declare function createEvent(event: MpEvent | string, node?: TaroElement): TaroEvent;
265
+ // 小程序的事件代理回调函数
266
+ declare function eventHandler(event: MpEvent): any;
293
267
  declare class TaroElement extends TaroNode {
268
+ ctx?: any;
294
269
  tagName: string;
295
270
  props: Record<string, any>;
296
271
  style: Style;
@@ -324,6 +299,37 @@ declare class TaroElement extends TaroNode {
324
299
  removeEventListener(type: any, handler: any, sideEffect?: boolean): void;
325
300
  static extend(methodName: string, options: Func | Record<string, any>): void;
326
301
  }
302
+ declare class FormElement extends TaroElement {
303
+ get type(): string;
304
+ set type(val: string);
305
+ get value(): string | boolean | number | any[];
306
+ set value(val: string | boolean | number | any[]);
307
+ dispatchEvent(event: TaroEvent): boolean;
308
+ }
309
+ declare class TaroDocument extends TaroElement {
310
+ documentElement: TaroElement;
311
+ head: TaroElement;
312
+ body: TaroElement;
313
+ createEvent: typeof createEvent;
314
+ constructor();
315
+ createElement(type: string): TaroElement | TaroRootElement | FormElement;
316
+ // an ugly fake createElementNS to deal with @vue/runtime-dom's
317
+ // support mounting app to svg container since vue@3.0.8
318
+ createElementNS(_svgNS: string, type: string): TaroElement | TaroRootElement | FormElement;
319
+ createTextNode(text: string): TaroText;
320
+ getElementById<T extends TaroElement>(id: string | undefined | null): T | null;
321
+ querySelector<T extends TaroElement>(query: string): T | null;
322
+ querySelectorAll(): never[];
323
+ // @TODO: @PERF: 在 hydrate 移除掉空的 node
324
+ createComment(): TaroText;
325
+ get defaultView(): any;
326
+ }
327
+ interface Env {
328
+ window: any;
329
+ document: TaroDocument;
330
+ }
331
+ declare const env: Env;
332
+ declare let document: any;
327
333
  declare function getComputedStyle(element: TaroElement): Style;
328
334
  declare const eventCenter: Events;
329
335
  type EventsType = typeof Events;
@@ -583,8 +589,67 @@ declare class MutationObserver {
583
589
  takeRecords(): MutationRecord[];
584
590
  static record(record: MutationRecord): void;
585
591
  }
592
+ declare const PROPERTY_THRESHOLD = 2046;
593
+ declare const TARO_RUNTIME = "Taro runtime";
594
+ declare const HOOKS_APP_ID = "taro-app";
595
+ declare const SET_DATA = "\u5C0F\u7A0B\u5E8F setData";
596
+ declare const PAGE_INIT = "\u9875\u9762\u521D\u59CB\u5316";
597
+ declare const ROOT_STR = "root";
598
+ declare const HTML = "html";
599
+ declare const HEAD = "head";
600
+ declare const BODY = "body";
601
+ declare const APP = "app";
602
+ declare const CONTAINER = "container";
603
+ declare const DOCUMENT_ELEMENT_NAME = "#document";
604
+ declare const DOCUMENT_FRAGMENT = "document-fragment";
605
+ declare const ID = "id";
606
+ declare const UID = "uid";
607
+ declare const CLASS = "class";
608
+ declare const STYLE = "style";
609
+ declare const FOCUS = "focus";
610
+ declare const VIEW = "view";
611
+ declare const STATIC_VIEW = "static-view";
612
+ declare const PURE_VIEW = "pure-view";
613
+ declare const PROPS = "props";
614
+ declare const DATASET = "dataset";
615
+ declare const OBJECT = "object";
616
+ declare const VALUE = "value";
617
+ declare const INPUT = "input";
618
+ declare const CHANGE = "change";
619
+ declare const CUSTOM_WRAPPER = "custom-wrapper";
620
+ declare const TARGET = "target";
621
+ declare const CURRENT_TARGET = "currentTarget";
622
+ declare const TYPE = "type";
623
+ declare const CONFIRM = "confirm";
624
+ declare const TIME_STAMP = "timeStamp";
625
+ declare const KEY_CODE = "keyCode";
626
+ declare const TOUCHMOVE = "touchmove";
627
+ declare const DATE = "Date";
628
+ declare const SET_TIMEOUT = "setTimeout";
629
+ declare const CATCHMOVE = "catchMove";
630
+ declare const CATCH_VIEW = "catch-view";
631
+ declare const COMMENT = "comment";
632
+ declare const ON_LOAD = "onLoad";
633
+ declare const ON_READY = "onReady";
634
+ declare const ON_SHOW = "onShow";
635
+ declare const ON_HIDE = "onHide";
636
+ declare const OPTIONS = "options";
637
+ declare const EXTERNAL_CLASSES = "externalClasses";
638
+ declare const EVENT_CALLBACK_RESULT = "e_result";
639
+ declare const BEHAVIORS = "behaviors";
640
+ declare const A = "a";
641
+ /**
642
+ * 页面上下文切换时的行为
643
+ */
644
+ declare enum CONTEXT_ACTIONS {
645
+ INIT = "0",
646
+ RESTORE = "1",
647
+ RECOVER = "2",
648
+ DESTORY = "3"
649
+ }
586
650
  interface Instance<T = Record<string, any>> extends Component<T>, Show, PageInstance {
587
651
  tid?: string;
652
+ node?: TaroElement;
588
653
  $forceUpdate?(): void;
589
654
  $nextTick?(cb: () => void): void;
590
655
  $options: Instance;
@@ -656,6 +721,7 @@ interface Show {
656
721
  interface AppInstance extends Show {
657
722
  componentDidShow?(options?: Record<string, unknown>): void;
658
723
  mount?(component: React.ComponentClass | ComponentOptions<VueCtor> | Vue3Component, id: string, cb: (...args: any[]) => void): void;
724
+ mount?(component: React.ComponentClass | ComponentOptions<VueCtor> | Vue3Component, id: string, getCtx: (...args: any[]) => void, cb: (...args: any[]) => void): void;
659
725
  onError?(error: string): void;
660
726
  onLaunch?(options?: Record<string, unknown>): void;
661
727
  onPageNotFound?(res: any): void;
@@ -694,6 +760,9 @@ declare function addLeadingSlash(path?: string): string;
694
760
  declare function safeExecute(path: string, lifecycle: string, ...args: unknown[]): any;
695
761
  declare function stringify(obj?: Record<string, unknown>): string;
696
762
  declare function getPath(id: string, options?: Record<string, unknown>): string;
763
+ declare function getOnReadyEventKey(path: string): string;
764
+ declare function getOnShowEventKey(path: string): string;
765
+ declare function getOnHideEventKey(path: string): string;
697
766
  declare function createPageConfig(component: any, pageName?: string, data?: Record<string, unknown>, pageConfig?: PageConfig): PageInstance;
698
767
  declare function createComponentConfig(component: React.ComponentClass, componentName?: string, data?: Record<string, unknown>): any;
699
768
  declare function createRecursiveComponentConfig(componentName?: string): any;
@@ -708,4 +777,4 @@ declare const nextTick: (cb: Func, ctx?: Record<string, any>) => void;
708
777
  declare const options: Options;
709
778
  declare const incrementId: () => () => string;
710
779
  export { hooks } from '@tarojs/shared';
711
- export { document, getComputedStyle, History, Location, nav as navigator, _caf as cancelAnimationFrame, now, _raf as requestAnimationFrame, parseUrl, URL, URLSearchParams, history, location, window, TaroElement, createEvent, eventHandler, TaroEvent, FormElement, TaroNode, TaroRootElement, Style, SVGElement, TaroText, MutationObserver, Current, getCurrentInstance, eventSource, addLeadingSlash, createComponentConfig, createPageConfig, createRecursiveComponentConfig, getPageInstance, getPath, injectPageInstance, removePageInstance, safeExecute, stringify, EventsType, eventCenter, Events, hydrate, nextTick, options, incrementId, Instance, VueAppInstance, VueInstance, PageProps, ReactPageComponent, ReactPageInstance, ReactAppInstance, PageLifeCycle, PageInstance, AppInstance, Attributes, EventOptions, MpEvent, EventListenerOptions, AddEventListenerOptions, EventHandler, MpInstance, MiniElementData, MiniData, HydratedData, UpdatePayloadValue, DataTree, UpdatePayload, Options$0 as Options, Func, Ctx };
780
+ export { document, getComputedStyle, History, Location, nav as navigator, _caf as cancelAnimationFrame, now, _raf as requestAnimationFrame, parseUrl, URL, URLSearchParams, history, location, window, TaroElement, createEvent, eventHandler, TaroEvent, FormElement, TaroNode, TaroRootElement, Style, SVGElement, TaroText, MutationObserver, env, PROPERTY_THRESHOLD, TARO_RUNTIME, HOOKS_APP_ID, SET_DATA, PAGE_INIT, ROOT_STR, HTML, HEAD, BODY, APP, CONTAINER, DOCUMENT_ELEMENT_NAME, DOCUMENT_FRAGMENT, ID, UID, CLASS, STYLE, FOCUS, VIEW, STATIC_VIEW, PURE_VIEW, PROPS, DATASET, OBJECT, VALUE, INPUT, CHANGE, CUSTOM_WRAPPER, TARGET, CURRENT_TARGET, TYPE, CONFIRM, TIME_STAMP, KEY_CODE, TOUCHMOVE, DATE, SET_TIMEOUT, CATCHMOVE, CATCH_VIEW, COMMENT, ON_LOAD, ON_READY, ON_SHOW, ON_HIDE, OPTIONS, EXTERNAL_CLASSES, EVENT_CALLBACK_RESULT, BEHAVIORS, A, CONTEXT_ACTIONS, Current, getCurrentInstance, eventSource, addLeadingSlash, createComponentConfig, createPageConfig, createRecursiveComponentConfig, getOnHideEventKey, getOnReadyEventKey, getOnShowEventKey, getPageInstance, getPath, injectPageInstance, removePageInstance, safeExecute, stringify, EventsType, eventCenter, Events, hydrate, nextTick, options, incrementId, Instance, VueAppInstance, VueInstance, PageProps, ReactPageComponent, ReactPageInstance, ReactAppInstance, PageLifeCycle, PageInstance, AppInstance, Attributes, EventOptions, MpEvent, EventListenerOptions, AddEventListenerOptions, EventHandler, MpInstance, MiniElementData, MiniData, HydratedData, UpdatePayloadValue, DataTree, UpdatePayload, Options$0 as Options, Func, Ctx };
@@ -2,6 +2,8 @@ import { noop, isFunction, getComponentsAlias as getComponentsAlias$1, internalC
2
2
  export { Events, hooks } from '@tarojs/shared';
3
3
 
4
4
  const PROPERTY_THRESHOLD = 2046;
5
+ const TARO_RUNTIME = 'Taro runtime';
6
+ const HOOKS_APP_ID = 'taro-app';
5
7
  const SET_DATA = '小程序 setData';
6
8
  const PAGE_INIT = '页面初始化';
7
9
  const ROOT_STR = 'root';
@@ -34,6 +36,8 @@ const CONFIRM = 'confirm';
34
36
  const TIME_STAMP = 'timeStamp';
35
37
  const KEY_CODE = 'keyCode';
36
38
  const TOUCHMOVE = 'touchmove';
39
+ const DATE = 'Date';
40
+ const SET_TIMEOUT = 'setTimeout';
37
41
  const CATCHMOVE = 'catchMove';
38
42
  const CATCH_VIEW = 'catch-view';
39
43
  const COMMENT = 'comment';
@@ -403,6 +407,7 @@ let componentsAlias;
403
407
  * it's a vnode traverser and modifier: that's exactly what Taro's doing in here.
404
408
  */
405
409
  function hydrate(node) {
410
+ var _a;
406
411
  if (!componentsAlias) {
407
412
  // 初始化 componentsAlias
408
413
  componentsAlias = getComponentsAlias();
@@ -415,7 +420,7 @@ function hydrate(node) {
415
420
  if (isText(node)) {
416
421
  return {
417
422
  ["v" /* Shortcuts.Text */]: node.nodeValue,
418
- ["nn" /* Shortcuts.NodeName */]: componentsAlias[nodeName]._num
423
+ ["nn" /* Shortcuts.NodeName */]: ((_a = componentsAlias[nodeName]) === null || _a === void 0 ? void 0 : _a._num) || '8'
419
424
  };
420
425
  }
421
426
  const data = {
@@ -2462,13 +2467,13 @@ class TaroEvent {
2462
2467
  this.defaultPrevented = true;
2463
2468
  }
2464
2469
  get target() {
2465
- var _a, _b;
2470
+ var _a, _b, _c;
2466
2471
  const cacheTarget = this.cacheTarget;
2467
2472
  if (!cacheTarget) {
2468
2473
  const target = Object.create(((_a = this.mpEvent) === null || _a === void 0 ? void 0 : _a.target) || null);
2469
- const element = env.document.getElementById(target.id);
2474
+ const element = env.document.getElementById(((_b = target.dataset) === null || _b === void 0 ? void 0 : _b.sid) || target.id || null);
2470
2475
  target.dataset = element !== null ? element.dataset : EMPTY_OBJ;
2471
- for (const key in (_b = this.mpEvent) === null || _b === void 0 ? void 0 : _b.detail) {
2476
+ for (const key in (_c = this.mpEvent) === null || _c === void 0 ? void 0 : _c.detail) {
2472
2477
  target[key] = this.mpEvent.detail[key];
2473
2478
  }
2474
2479
  this.cacheTarget = target;
@@ -2479,19 +2484,19 @@ class TaroEvent {
2479
2484
  }
2480
2485
  }
2481
2486
  get currentTarget() {
2482
- var _a, _b, _c, _d;
2487
+ var _a, _b, _c, _d, _e, _f, _g, _h;
2483
2488
  const cacheCurrentTarget = this.cacheCurrentTarget;
2484
2489
  if (!cacheCurrentTarget) {
2485
2490
  const doc = env.document;
2486
2491
  const currentTarget = Object.create(((_a = this.mpEvent) === null || _a === void 0 ? void 0 : _a.currentTarget) || null);
2487
- const element = doc.getElementById(currentTarget.id);
2488
- const targetElement = doc.getElementById(((_c = (_b = this.mpEvent) === null || _b === void 0 ? void 0 : _b.target) === null || _c === void 0 ? void 0 : _c.id) || null);
2492
+ const element = doc.getElementById(((_b = currentTarget.dataset) === null || _b === void 0 ? void 0 : _b.sid) || currentTarget.id || null);
2493
+ const targetElement = doc.getElementById(((_e = (_d = (_c = this.mpEvent) === null || _c === void 0 ? void 0 : _c.target) === null || _d === void 0 ? void 0 : _d.dataset) === null || _e === void 0 ? void 0 : _e.sid) || ((_g = (_f = this.mpEvent) === null || _f === void 0 ? void 0 : _f.target) === null || _g === void 0 ? void 0 : _g.id) || null);
2489
2494
  if (element === null || (element && element === targetElement)) {
2490
2495
  this.cacheCurrentTarget = this.target;
2491
2496
  return this.target;
2492
2497
  }
2493
2498
  currentTarget.dataset = element.dataset;
2494
- for (const key in (_d = this.mpEvent) === null || _d === void 0 ? void 0 : _d.detail) {
2499
+ for (const key in (_h = this.mpEvent) === null || _h === void 0 ? void 0 : _h.detail) {
2495
2500
  currentTarget[key] = this.mpEvent.detail[key];
2496
2501
  }
2497
2502
  this.cacheCurrentTarget = currentTarget;
@@ -3238,9 +3243,6 @@ class AnchorElement extends TaroElement {
3238
3243
  }
3239
3244
  }
3240
3245
 
3241
- class CustomWrapperElement extends TaroElement {
3242
- }
3243
-
3244
3246
  class TaroDocument extends TaroElement {
3245
3247
  constructor() {
3246
3248
  super();
@@ -3261,9 +3263,6 @@ class TaroDocument extends TaroElement {
3261
3263
  case nodeName === A:
3262
3264
  element = new AnchorElement();
3263
3265
  break;
3264
- case nodeName === CUSTOM_WRAPPER:
3265
- element = new CustomWrapperElement();
3266
- break;
3267
3266
  default:
3268
3267
  element = new TaroElement();
3269
3268
  break;
@@ -4094,7 +4093,8 @@ function createComponentConfig(component, componentName, data) {
4094
4093
  [ATTACHED]() {
4095
4094
  var _a;
4096
4095
  perf.start(PAGE_INIT);
4097
- const path = getPath(id, { id: ((_a = this.getPageId) === null || _a === void 0 ? void 0 : _a.call(this)) || pageId() });
4096
+ this.pageIdCache = ((_a = this.getPageId) === null || _a === void 0 ? void 0 : _a.call(this)) || pageId();
4097
+ const path = getPath(id, { id: this.pageIdCache });
4098
4098
  Current.app.mount(component, path, () => {
4099
4099
  componentElement = env.document.getElementById(path);
4100
4100
  ensure(componentElement !== null, '没有找到组件实例。');
@@ -4107,7 +4107,7 @@ function createComponentConfig(component, componentName, data) {
4107
4107
  });
4108
4108
  },
4109
4109
  [DETACHED]() {
4110
- const path = getPath(id, { id: this.getPageId() });
4110
+ const path = getPath(id, { id: this.pageIdCache });
4111
4111
  Current.app.unmount(path, () => {
4112
4112
  instances.delete(path);
4113
4113
  if (componentElement) {
@@ -4218,5 +4218,5 @@ const nextTick = (cb, ctx) => {
4218
4218
  next();
4219
4219
  };
4220
4220
 
4221
- export { Current, FormElement, History, Location, MutationObserver, SVGElement, Style, TaroElement, TaroEvent, TaroNode, TaroRootElement, TaroText, URL, URLSearchParams, addLeadingSlash, _caf as cancelAnimationFrame, createComponentConfig, createEvent, createPageConfig, createRecursiveComponentConfig, document$1 as document, eventCenter, eventHandler, eventSource, getComputedStyle, getCurrentInstance, getPageInstance, getPath, history, hydrate, incrementId, injectPageInstance, location, nav as navigator, nextTick, now, options, parseUrl, removePageInstance, _raf as requestAnimationFrame, safeExecute, stringify, window$1 as window };
4221
+ export { A, APP, BEHAVIORS, BODY, CATCHMOVE, CATCH_VIEW, CHANGE, CLASS, COMMENT, CONFIRM, CONTAINER, CONTEXT_ACTIONS, CURRENT_TARGET, CUSTOM_WRAPPER, Current, DATASET, DATE, DOCUMENT_ELEMENT_NAME, DOCUMENT_FRAGMENT, EVENT_CALLBACK_RESULT, EXTERNAL_CLASSES, FOCUS, FormElement, HEAD, HOOKS_APP_ID, HTML, History, ID, INPUT, KEY_CODE, Location, MutationObserver, OBJECT, ON_HIDE, ON_LOAD, ON_READY, ON_SHOW, OPTIONS, PAGE_INIT, PROPERTY_THRESHOLD, PROPS, PURE_VIEW, ROOT_STR, SET_DATA, SET_TIMEOUT, STATIC_VIEW, STYLE, SVGElement, Style, TARGET, TARO_RUNTIME, TIME_STAMP, TOUCHMOVE, TYPE, TaroElement, TaroEvent, TaroNode, TaroRootElement, TaroText, UID, URL, URLSearchParams, VALUE, VIEW, addLeadingSlash, _caf as cancelAnimationFrame, createComponentConfig, createEvent, createPageConfig, createRecursiveComponentConfig, document$1 as document, env, eventCenter, eventHandler, eventSource, getComputedStyle, getCurrentInstance, getOnHideEventKey, getOnReadyEventKey, getOnShowEventKey, getPageInstance, getPath, history, hydrate, incrementId, injectPageInstance, location, nav as navigator, nextTick, now, options, parseUrl, removePageInstance, _raf as requestAnimationFrame, safeExecute, stringify, window$1 as window };
4222
4222
  //# sourceMappingURL=runtime.esm.js.map