@tarojs/runtime 3.3.11 → 3.3.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.
- package/dist/dom/element.d.ts +2 -1
- package/dist/runtime.esm.js +35 -21
- package/dist/runtime.esm.js.map +1 -1
- package/package.json +4 -4
package/dist/dom/element.d.ts
CHANGED
|
@@ -27,7 +27,8 @@ export declare class TaroElement extends TaroNode {
|
|
|
27
27
|
set textContent(text: string);
|
|
28
28
|
hasAttribute(qualifiedName: string): boolean;
|
|
29
29
|
hasAttributes(): boolean;
|
|
30
|
-
focus(): void;
|
|
30
|
+
get focus(): () => void;
|
|
31
|
+
set focus(value: () => void);
|
|
31
32
|
blur(): void;
|
|
32
33
|
setAttribute(qualifiedName: string, value: any): void;
|
|
33
34
|
removeAttribute(qualifiedName: string): void;
|
package/dist/runtime.esm.js
CHANGED
|
@@ -1234,7 +1234,6 @@ const TIME_STAMP = 'timeStamp';
|
|
|
1234
1234
|
const KEY_CODE = 'keyCode';
|
|
1235
1235
|
const TOUCHMOVE = 'touchmove';
|
|
1236
1236
|
const DATE = 'Date';
|
|
1237
|
-
const SET_TIMEOUT = 'setTimeout';
|
|
1238
1237
|
const CATCHMOVE = 'catchMove';
|
|
1239
1238
|
const CATCH_VIEW = 'catch-view';
|
|
1240
1239
|
const COMMENT = 'comment';
|
|
@@ -2103,8 +2102,14 @@ let TaroElement = class TaroElement extends TaroNode {
|
|
|
2103
2102
|
hasAttributes() {
|
|
2104
2103
|
return this.attributes.length > 0;
|
|
2105
2104
|
}
|
|
2106
|
-
focus() {
|
|
2107
|
-
|
|
2105
|
+
get focus() {
|
|
2106
|
+
return function () {
|
|
2107
|
+
this.setAttribute(FOCUS, true);
|
|
2108
|
+
};
|
|
2109
|
+
}
|
|
2110
|
+
// 兼容 Vue3,详情请见:https://github.com/NervJS/taro/issues/10579
|
|
2111
|
+
set focus(value) {
|
|
2112
|
+
this.setAttribute(FOCUS, value);
|
|
2108
2113
|
}
|
|
2109
2114
|
blur() {
|
|
2110
2115
|
this.setAttribute(FOCUS, false);
|
|
@@ -4212,9 +4217,9 @@ function format(children, document, styleOptions, parent) {
|
|
|
4212
4217
|
.map((child) => {
|
|
4213
4218
|
// 文本节点
|
|
4214
4219
|
if (child.type === 'text') {
|
|
4215
|
-
|
|
4220
|
+
let text = document.createTextNode(child.content);
|
|
4216
4221
|
if (isFunction$1(options.html.transformText)) {
|
|
4217
|
-
|
|
4222
|
+
text = options.html.transformText(text, child);
|
|
4218
4223
|
}
|
|
4219
4224
|
parent === null || parent === void 0 ? void 0 : parent.appendChild(text);
|
|
4220
4225
|
return text;
|
|
@@ -5013,9 +5018,12 @@ if (process.env.TARO_ENV && process.env.TARO_ENV !== 'h5') {
|
|
|
5013
5018
|
if (!(DATE in window$1)) {
|
|
5014
5019
|
window$1.Date = Date;
|
|
5015
5020
|
}
|
|
5016
|
-
|
|
5017
|
-
|
|
5018
|
-
}
|
|
5021
|
+
window$1.setTimeout = function (cb, delay) {
|
|
5022
|
+
setTimeout(cb, delay);
|
|
5023
|
+
};
|
|
5024
|
+
window$1.clearTimeout = function (seed) {
|
|
5025
|
+
clearTimeout(seed);
|
|
5026
|
+
};
|
|
5019
5027
|
}
|
|
5020
5028
|
|
|
5021
5029
|
const Current = {
|
|
@@ -5178,8 +5186,11 @@ function createPageConfig(component, pageName, data, pageConfig) {
|
|
|
5178
5186
|
let pageElement = null;
|
|
5179
5187
|
let unmounting = false;
|
|
5180
5188
|
let prepareMountList = [];
|
|
5189
|
+
let loadResolver;
|
|
5190
|
+
let hasLoaded;
|
|
5181
5191
|
const config = {
|
|
5182
5192
|
onLoad(options, cb) {
|
|
5193
|
+
hasLoaded = new Promise(resolve => { loadResolver = resolve; });
|
|
5183
5194
|
perf.start(PAGE_INIT);
|
|
5184
5195
|
Current.page = this;
|
|
5185
5196
|
this.config = pageConfig || {};
|
|
@@ -5203,6 +5214,7 @@ function createPageConfig(component, pageName, data, pageConfig) {
|
|
|
5203
5214
|
pageElement = document$2.getElementById(this.$taroPath);
|
|
5204
5215
|
ensure(pageElement !== null, '没有找到页面实例。');
|
|
5205
5216
|
safeExecute(this.$taroPath, 'onLoad', this.$taroParams);
|
|
5217
|
+
loadResolver();
|
|
5206
5218
|
if (!isBrowser) {
|
|
5207
5219
|
pageElement.ctx = this;
|
|
5208
5220
|
pageElement.performUpdate(true, cb);
|
|
@@ -5241,20 +5253,22 @@ function createPageConfig(component, pageName, data, pageConfig) {
|
|
|
5241
5253
|
});
|
|
5242
5254
|
},
|
|
5243
5255
|
onShow() {
|
|
5244
|
-
|
|
5245
|
-
|
|
5246
|
-
|
|
5247
|
-
|
|
5248
|
-
|
|
5249
|
-
|
|
5250
|
-
|
|
5251
|
-
|
|
5252
|
-
|
|
5253
|
-
|
|
5254
|
-
|
|
5255
|
-
|
|
5256
|
+
hasLoaded.then(() => {
|
|
5257
|
+
Current.page = this;
|
|
5258
|
+
this.config = pageConfig || {};
|
|
5259
|
+
const router = isBrowser ? this.$taroPath : this.route || this.__route__;
|
|
5260
|
+
Current.router = {
|
|
5261
|
+
params: this.$taroParams,
|
|
5262
|
+
path: addLeadingSlash(router),
|
|
5263
|
+
onReady: getOnReadyEventKey(id),
|
|
5264
|
+
onShow: getOnShowEventKey(id),
|
|
5265
|
+
onHide: getOnHideEventKey(id)
|
|
5266
|
+
};
|
|
5267
|
+
raf(() => {
|
|
5268
|
+
eventCenter.trigger(getOnShowEventKey(id));
|
|
5269
|
+
});
|
|
5270
|
+
safeExecute(this.$taroPath, 'onShow');
|
|
5256
5271
|
});
|
|
5257
|
-
safeExecute(this.$taroPath, 'onShow');
|
|
5258
5272
|
},
|
|
5259
5273
|
onHide() {
|
|
5260
5274
|
Current.page = null;
|