@tarojs/with-weapp 3.5.0-canary.1 → 3.5.0-theta.0
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/index.esm.js +226 -226
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +250 -250
- package/dist/index.js.map +1 -1
- package/dist/with-weapp.js +254 -254
- package/dist/with-weapp.js.map +1 -1
- package/index.js +1 -0
- package/package.json +4 -5
- package/src/index.ts +20 -22
- package/src/utils.ts +3 -3
- package/LICENSE +0 -21
package/dist/index.esm.js
CHANGED
|
@@ -9,169 +9,113 @@ import _inherits from '@babel/runtime/helpers/inherits';
|
|
|
9
9
|
import _possibleConstructorReturn from '@babel/runtime/helpers/possibleConstructorReturn';
|
|
10
10
|
import _getPrototypeOf from '@babel/runtime/helpers/getPrototypeOf';
|
|
11
11
|
import _typeof from '@babel/runtime/helpers/typeof';
|
|
12
|
-
import { nextTick, eventCenter } from '@tarojs/taro';
|
|
13
12
|
import { getCurrentInstance } from '@tarojs/runtime';
|
|
13
|
+
import { nextTick, eventCenter } from '@tarojs/taro';
|
|
14
14
|
|
|
15
|
-
var
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
(function (TaroLifeCycles) {
|
|
20
|
-
TaroLifeCycles["WillMount"] = "componentWillMount";
|
|
21
|
-
TaroLifeCycles["DidMount"] = "componentDidMount";
|
|
22
|
-
TaroLifeCycles["DidShow"] = "componentDidShow";
|
|
23
|
-
TaroLifeCycles["DidHide"] = "componentDidHide";
|
|
24
|
-
TaroLifeCycles["WillUnmount"] = "componentWillUnmount";
|
|
25
|
-
})(TaroLifeCycles || (TaroLifeCycles = {}));
|
|
26
|
-
|
|
27
|
-
var lifecycleMap = (_lifecycleMap = {}, _defineProperty(_lifecycleMap, TaroLifeCycles.WillMount, ['created']), _defineProperty(_lifecycleMap, TaroLifeCycles.DidMount, ['attached']), _defineProperty(_lifecycleMap, TaroLifeCycles.DidShow, ['onShow']), _defineProperty(_lifecycleMap, TaroLifeCycles.DidHide, ['onHide']), _defineProperty(_lifecycleMap, TaroLifeCycles.WillUnmount, ['detached', 'onUnload']), _lifecycleMap);
|
|
28
|
-
var lifecycles = new Set(['ready']);
|
|
29
|
-
|
|
30
|
-
for (var key in lifecycleMap) {
|
|
31
|
-
var lifecycle = lifecycleMap[key];
|
|
32
|
-
lifecycle.forEach(function (l) {
|
|
33
|
-
return lifecycles.add(l);
|
|
34
|
-
});
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
var uniquePageLifecycle = ['onPullDownRefresh', 'onReachBottom', 'onShareAppMessage', 'onShareTimeline', 'onAddToFavorites', 'onPageScroll', 'onResize', 'onTabItemTap'];
|
|
38
|
-
var appOptions = ['onLaunch', 'onShow', 'onHide', 'onError', 'onPageNotFound', 'onUnhandledRejection', 'onThemeChange'];
|
|
15
|
+
var json = JSON;
|
|
16
|
+
var clone = function clone(obj) {
|
|
17
|
+
return json.parse(stringify(obj));
|
|
18
|
+
};
|
|
39
19
|
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
function bind(fn
|
|
44
|
-
/*: Function */
|
|
45
|
-
, ctx
|
|
46
|
-
/*: Object */
|
|
47
|
-
) {
|
|
48
|
-
if (!fn) return false;
|
|
20
|
+
var isArray = Array.isArray || function (x) {
|
|
21
|
+
return {}.toString.call(x) === '[object Array]';
|
|
22
|
+
};
|
|
49
23
|
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
return l ? l > 1 ? fn.apply(ctx, arguments) : fn.call(ctx, a) : fn.call(ctx);
|
|
55
|
-
} // record original fn length
|
|
24
|
+
var objectKeys = Object.keys || function (obj) {
|
|
25
|
+
var has = Object.prototype.hasOwnProperty || function () {
|
|
26
|
+
return true;
|
|
27
|
+
};
|
|
56
28
|
|
|
29
|
+
var keys = [];
|
|
57
30
|
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
}
|
|
61
|
-
function isEqual(obj1, obj2) {
|
|
62
|
-
return JSON.stringify(obj1) === JSON.stringify(obj2);
|
|
63
|
-
}
|
|
64
|
-
function safeGet(obj, propsArg, defaultValue) {
|
|
65
|
-
if (!obj) {
|
|
66
|
-
return defaultValue;
|
|
31
|
+
for (var key in obj) {
|
|
32
|
+
if (has.call(obj, key)) keys.push(key);
|
|
67
33
|
}
|
|
68
34
|
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
if (Array.isArray(propsArg)) {
|
|
72
|
-
props = propsArg.slice(0);
|
|
73
|
-
}
|
|
35
|
+
return keys;
|
|
36
|
+
};
|
|
74
37
|
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
38
|
+
function stringify(obj, opts) {
|
|
39
|
+
if (!opts) opts = {};
|
|
40
|
+
if (typeof opts === 'function') opts = {
|
|
41
|
+
cmp: opts
|
|
42
|
+
};
|
|
43
|
+
var space = opts.space || '';
|
|
44
|
+
if (typeof space === 'number') space = Array(space + 1).join(' ');
|
|
45
|
+
var cycles = typeof opts.cycles === 'boolean' ? opts.cycles : false;
|
|
79
46
|
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
}
|
|
47
|
+
var replacer = opts.replacer || function (key, value) {
|
|
48
|
+
return value;
|
|
49
|
+
};
|
|
83
50
|
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
51
|
+
var cmp = opts.cmp && function (f) {
|
|
52
|
+
return function (node) {
|
|
53
|
+
return function (a, b) {
|
|
54
|
+
var aobj = {
|
|
55
|
+
key: a,
|
|
56
|
+
value: node[a]
|
|
57
|
+
};
|
|
58
|
+
var bobj = {
|
|
59
|
+
key: b,
|
|
60
|
+
value: node[b]
|
|
61
|
+
};
|
|
62
|
+
return f(aobj, bobj);
|
|
63
|
+
};
|
|
64
|
+
};
|
|
65
|
+
}(opts.cmp);
|
|
87
66
|
|
|
88
|
-
|
|
89
|
-
|
|
67
|
+
var seen = [];
|
|
68
|
+
return function stringify(parent, key, node, level) {
|
|
69
|
+
var indent = space ? '\n' + new Array(level + 1).join(space) : '';
|
|
70
|
+
var colonSeparator = space ? ': ' : ':';
|
|
90
71
|
|
|
91
|
-
if (
|
|
92
|
-
|
|
72
|
+
if (node && node.toJSON && typeof node.toJSON === 'function') {
|
|
73
|
+
node = node.toJSON();
|
|
93
74
|
}
|
|
94
75
|
|
|
95
|
-
|
|
76
|
+
node = replacer.call(parent, key, node);
|
|
96
77
|
|
|
97
|
-
if (
|
|
98
|
-
return
|
|
78
|
+
if (node === undefined) {
|
|
79
|
+
return;
|
|
99
80
|
}
|
|
100
|
-
}
|
|
101
81
|
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
function safeSet(obj, props, value) {
|
|
105
|
-
if (typeof props === 'string') {
|
|
106
|
-
props = props.replace(/\[(.+?)\]/g, '.$1');
|
|
107
|
-
props = props.split('.');
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
if (_typeof(props) === 'symbol') {
|
|
111
|
-
props = [props];
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
var lastProp = props.pop();
|
|
115
|
-
|
|
116
|
-
if (!lastProp) {
|
|
117
|
-
return false;
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
var thisProp;
|
|
121
|
-
|
|
122
|
-
while (thisProp = props.shift()) {
|
|
123
|
-
if (typeof obj[thisProp] === 'undefined') {
|
|
124
|
-
obj[thisProp] = {};
|
|
125
|
-
} // 直接按路径修改 this.state 可能会导致 nextProps 也被修改
|
|
126
|
-
// 因此按路径寻找时,每一层都复制一遍
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
if (Array.isArray(obj[thisProp])) {
|
|
130
|
-
obj[thisProp] = _toConsumableArray(obj[thisProp]);
|
|
131
|
-
} else if (_typeof(obj[thisProp]) === 'object') {
|
|
132
|
-
obj[thisProp] = Object.assign({}, obj[thisProp]);
|
|
82
|
+
if (_typeof(node) !== 'object' || node === null) {
|
|
83
|
+
return json.stringify(node);
|
|
133
84
|
}
|
|
134
85
|
|
|
135
|
-
|
|
86
|
+
if (isArray(node)) {
|
|
87
|
+
var out = [];
|
|
136
88
|
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
89
|
+
for (var i = 0; i < node.length; i++) {
|
|
90
|
+
var item = stringify(node, i, node[i], level + 1) || json.stringify(null);
|
|
91
|
+
out.push(indent + space + item);
|
|
92
|
+
}
|
|
141
93
|
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
}
|
|
148
|
-
var unsupport = new Map([['onError', '不支持 App 的 onError 生命周期方法。'], ['onPageNotFound', '不支持 App 的 onPageNotFound 生命周期方法。'], ['onUnhandledRejection', '不支持 App 的 onUnhandledRejection 生命周期方法。'], ['onThemeChange', '不支持 App 的 onThemeChange 生命周期方法。'], ['moved', '不支持自定义组件的 moved 生命周期。'], ['externalClasses', '不支持自定义组件的 externalClasses 功能。'], ['relations', '不支持自定义组件的 relations 功能。'], ['options', '不支持自定义组件的 options 功能。'], ['definitionFilter', '不支持自定义组件的 definitionFilter 功能。'], ['selectComponent', 'selectComponent 方法产生不到目标效果,请使用 React 的 ref 进行重构。'], ['selectAllComponents', 'selectAllComponents 方法产生不到目标效果,请使用 React 的 ref 进行重构。'], ['selectOwnerComponent', 'selectOwnerComponent 方法产生不到目标效果,请使用 React 语法重构。'], ['groupSetData', 'groupSetData 方法产生不到目标效果,请使用 React 语法重构。']]);
|
|
149
|
-
function flattenBehaviors(behavior, behaviorMap) {
|
|
150
|
-
if (typeof behavior === 'string') {
|
|
151
|
-
return report("\u4E0D\u652F\u6301\u4F7F\u7528\u5185\u7F6E Behavior: [".concat(behavior, "]"));
|
|
152
|
-
}
|
|
94
|
+
return '[' + out.join(',') + indent + ']';
|
|
95
|
+
} else {
|
|
96
|
+
if (seen.indexOf(node) !== -1) {
|
|
97
|
+
if (cycles) return json.stringify('__cycle__');
|
|
98
|
+
throw new TypeError('Converting circular structure to JSON');
|
|
99
|
+
} else seen.push(node);
|
|
153
100
|
|
|
154
|
-
|
|
101
|
+
var keys = objectKeys(node).sort(cmp && cmp(node));
|
|
102
|
+
var _out = [];
|
|
155
103
|
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
104
|
+
for (var _i = 0; _i < keys.length; _i++) {
|
|
105
|
+
var _key = keys[_i];
|
|
106
|
+
var value = stringify(node, _key, node[_key], level + 1);
|
|
107
|
+
if (!value) continue;
|
|
108
|
+
var keyValue = json.stringify(_key) + colonSeparator + value;
|
|
161
109
|
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
if (unsupport.has(key)) {
|
|
165
|
-
var advise = unsupport.get(key);
|
|
166
|
-
return report(advise);
|
|
167
|
-
}
|
|
110
|
+
_out.push(indent + space + keyValue);
|
|
111
|
+
}
|
|
168
112
|
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
var value = behavior[key];
|
|
172
|
-
list.push(value);
|
|
113
|
+
seen.splice(seen.indexOf(node), 1);
|
|
114
|
+
return '{' + _out.join(',') + indent + '}';
|
|
173
115
|
}
|
|
174
|
-
}
|
|
116
|
+
}({
|
|
117
|
+
'': obj
|
|
118
|
+
}, '', obj, 0);
|
|
175
119
|
}
|
|
176
120
|
|
|
177
121
|
/*eslint-disable*/
|
|
@@ -286,110 +230,166 @@ function type(obj) {
|
|
|
286
230
|
return Object.prototype.toString.call(obj);
|
|
287
231
|
}
|
|
288
232
|
|
|
289
|
-
var
|
|
290
|
-
var clone = function clone(obj) {
|
|
291
|
-
return json.parse(stringify(obj));
|
|
292
|
-
};
|
|
233
|
+
var _lifecycleMap;
|
|
293
234
|
|
|
294
|
-
var
|
|
295
|
-
return {}.toString.call(x) === '[object Array]';
|
|
296
|
-
};
|
|
235
|
+
var TaroLifeCycles;
|
|
297
236
|
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
237
|
+
(function (TaroLifeCycles) {
|
|
238
|
+
TaroLifeCycles["WillMount"] = "componentWillMount";
|
|
239
|
+
TaroLifeCycles["DidMount"] = "componentDidMount";
|
|
240
|
+
TaroLifeCycles["DidShow"] = "componentDidShow";
|
|
241
|
+
TaroLifeCycles["DidHide"] = "componentDidHide";
|
|
242
|
+
TaroLifeCycles["WillUnmount"] = "componentWillUnmount";
|
|
243
|
+
})(TaroLifeCycles || (TaroLifeCycles = {}));
|
|
302
244
|
|
|
303
|
-
|
|
245
|
+
var lifecycleMap = (_lifecycleMap = {}, _defineProperty(_lifecycleMap, TaroLifeCycles.WillMount, ['created']), _defineProperty(_lifecycleMap, TaroLifeCycles.DidMount, ['attached']), _defineProperty(_lifecycleMap, TaroLifeCycles.DidShow, ['onShow']), _defineProperty(_lifecycleMap, TaroLifeCycles.DidHide, ['onHide']), _defineProperty(_lifecycleMap, TaroLifeCycles.WillUnmount, ['detached', 'onUnload']), _lifecycleMap);
|
|
246
|
+
var lifecycles = new Set(['ready']);
|
|
304
247
|
|
|
305
|
-
|
|
306
|
-
|
|
248
|
+
for (var key in lifecycleMap) {
|
|
249
|
+
var lifecycle = lifecycleMap[key];
|
|
250
|
+
lifecycle.forEach(function (l) {
|
|
251
|
+
return lifecycles.add(l);
|
|
252
|
+
});
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
var uniquePageLifecycle = ['onPullDownRefresh', 'onReachBottom', 'onShareAppMessage', 'onShareTimeline', 'onAddToFavorites', 'onPageScroll', 'onResize', 'onTabItemTap'];
|
|
256
|
+
var appOptions = ['onLaunch', 'onShow', 'onHide', 'onError', 'onPageNotFound', 'onUnhandledRejection', 'onThemeChange'];
|
|
257
|
+
|
|
258
|
+
/**
|
|
259
|
+
* Simple bind, faster than native
|
|
260
|
+
*/
|
|
261
|
+
function bind(fn
|
|
262
|
+
/*: Function */
|
|
263
|
+
, ctx
|
|
264
|
+
/*: Object */
|
|
265
|
+
) {
|
|
266
|
+
if (!fn) return false;
|
|
267
|
+
|
|
268
|
+
function boundFn(a) {
|
|
269
|
+
var l
|
|
270
|
+
/*: number */
|
|
271
|
+
= arguments.length;
|
|
272
|
+
return l ? l > 1 ? fn.apply(ctx, arguments) : fn.call(ctx, a) : fn.call(ctx);
|
|
273
|
+
} // record original fn length
|
|
274
|
+
|
|
275
|
+
|
|
276
|
+
boundFn._length = fn.length;
|
|
277
|
+
return boundFn;
|
|
278
|
+
}
|
|
279
|
+
function isEqual(obj1, obj2) {
|
|
280
|
+
return JSON.stringify(obj1) === JSON.stringify(obj2);
|
|
281
|
+
}
|
|
282
|
+
function safeGet(obj, propsArg, defaultValue) {
|
|
283
|
+
if (!obj) {
|
|
284
|
+
return defaultValue;
|
|
307
285
|
}
|
|
308
286
|
|
|
309
|
-
|
|
310
|
-
};
|
|
287
|
+
var props, prop;
|
|
311
288
|
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
cmp: opts
|
|
316
|
-
};
|
|
317
|
-
var space = opts.space || '';
|
|
318
|
-
if (typeof space === 'number') space = Array(space + 1).join(' ');
|
|
319
|
-
var cycles = typeof opts.cycles === 'boolean' ? opts.cycles : false;
|
|
289
|
+
if (Array.isArray(propsArg)) {
|
|
290
|
+
props = propsArg.slice(0);
|
|
291
|
+
}
|
|
320
292
|
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
293
|
+
if (typeof propsArg === 'string') {
|
|
294
|
+
props = propsArg.replace(/\[(.+?)\]/g, '.$1');
|
|
295
|
+
props = props.split('.');
|
|
296
|
+
}
|
|
324
297
|
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
var aobj = {
|
|
329
|
-
key: a,
|
|
330
|
-
value: node[a]
|
|
331
|
-
};
|
|
332
|
-
var bobj = {
|
|
333
|
-
key: b,
|
|
334
|
-
value: node[b]
|
|
335
|
-
};
|
|
336
|
-
return f(aobj, bobj);
|
|
337
|
-
};
|
|
338
|
-
};
|
|
339
|
-
}(opts.cmp);
|
|
298
|
+
if (_typeof(propsArg) === 'symbol') {
|
|
299
|
+
props = [propsArg];
|
|
300
|
+
}
|
|
340
301
|
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
var colonSeparator = space ? ': ' : ':';
|
|
302
|
+
if (!Array.isArray(props)) {
|
|
303
|
+
throw new Error('props arg must be an array, a string or a symbol');
|
|
304
|
+
}
|
|
345
305
|
|
|
346
|
-
|
|
347
|
-
|
|
306
|
+
while (props.length) {
|
|
307
|
+
prop = props.shift();
|
|
308
|
+
|
|
309
|
+
if (!obj) {
|
|
310
|
+
return defaultValue;
|
|
348
311
|
}
|
|
349
312
|
|
|
350
|
-
|
|
313
|
+
obj = obj[prop];
|
|
351
314
|
|
|
352
|
-
if (
|
|
353
|
-
return;
|
|
315
|
+
if (obj === undefined) {
|
|
316
|
+
return defaultValue;
|
|
354
317
|
}
|
|
318
|
+
}
|
|
355
319
|
|
|
356
|
-
|
|
357
|
-
|
|
320
|
+
return obj;
|
|
321
|
+
}
|
|
322
|
+
function safeSet(obj, props, value) {
|
|
323
|
+
if (typeof props === 'string') {
|
|
324
|
+
props = props.replace(/\[(.+?)\]/g, '.$1');
|
|
325
|
+
props = props.split('.');
|
|
326
|
+
}
|
|
327
|
+
|
|
328
|
+
if (_typeof(props) === 'symbol') {
|
|
329
|
+
props = [props];
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
var lastProp = props.pop();
|
|
333
|
+
|
|
334
|
+
if (!lastProp) {
|
|
335
|
+
return false;
|
|
336
|
+
}
|
|
337
|
+
|
|
338
|
+
var thisProp;
|
|
339
|
+
|
|
340
|
+
while (thisProp = props.shift()) {
|
|
341
|
+
if (typeof obj[thisProp] === 'undefined') {
|
|
342
|
+
obj[thisProp] = {};
|
|
343
|
+
} // 直接按路径修改 this.state 可能会导致 nextProps 也被修改
|
|
344
|
+
// 因此按路径寻找时,每一层都复制一遍
|
|
345
|
+
|
|
346
|
+
|
|
347
|
+
if (Array.isArray(obj[thisProp])) {
|
|
348
|
+
obj[thisProp] = _toConsumableArray(obj[thisProp]);
|
|
349
|
+
} else if (_typeof(obj[thisProp]) === 'object') {
|
|
350
|
+
obj[thisProp] = Object.assign({}, obj[thisProp]);
|
|
358
351
|
}
|
|
359
352
|
|
|
360
|
-
|
|
361
|
-
var out = [];
|
|
353
|
+
obj = obj[thisProp];
|
|
362
354
|
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
355
|
+
if (!obj || _typeof(obj) !== 'object') {
|
|
356
|
+
return false;
|
|
357
|
+
}
|
|
358
|
+
}
|
|
367
359
|
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
360
|
+
obj[lastProp] = value;
|
|
361
|
+
return true;
|
|
362
|
+
}
|
|
363
|
+
function report(msg) {
|
|
364
|
+
console.warn('[Taro Convert Warning] ' + msg);
|
|
365
|
+
}
|
|
366
|
+
var nonsupport = new Map([['onError', '不支持 App 的 onError 生命周期方法。'], ['onPageNotFound', '不支持 App 的 onPageNotFound 生命周期方法。'], ['onUnhandledRejection', '不支持 App 的 onUnhandledRejection 生命周期方法。'], ['onThemeChange', '不支持 App 的 onThemeChange 生命周期方法。'], ['moved', '不支持自定义组件的 moved 生命周期。'], ['externalClasses', '不支持自定义组件的 externalClasses 功能。'], ['relations', '不支持自定义组件的 relations 功能。'], ['options', '不支持自定义组件的 options 功能。'], ['definitionFilter', '不支持自定义组件的 definitionFilter 功能。'], ['selectComponent', 'selectComponent 方法产生不到目标效果,请使用 React 的 ref 进行重构。'], ['selectAllComponents', 'selectAllComponents 方法产生不到目标效果,请使用 React 的 ref 进行重构。'], ['selectOwnerComponent', 'selectOwnerComponent 方法产生不到目标效果,请使用 React 语法重构。'], ['groupSetData', 'groupSetData 方法产生不到目标效果,请使用 React 语法重构。']]);
|
|
367
|
+
function flattenBehaviors(behavior, behaviorMap) {
|
|
368
|
+
if (typeof behavior === 'string') {
|
|
369
|
+
return report("\u4E0D\u652F\u6301\u4F7F\u7528\u5185\u7F6E Behavior: [".concat(behavior, "]"));
|
|
370
|
+
}
|
|
374
371
|
|
|
375
|
-
|
|
376
|
-
var _out = [];
|
|
372
|
+
var subBehaviors = behavior.behaviors;
|
|
377
373
|
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
374
|
+
if (subBehaviors === null || subBehaviors === void 0 ? void 0 : subBehaviors.length) {
|
|
375
|
+
subBehaviors.forEach(function (subBehavior) {
|
|
376
|
+
return flattenBehaviors(subBehavior, behaviorMap);
|
|
377
|
+
});
|
|
378
|
+
}
|
|
383
379
|
|
|
384
|
-
|
|
385
|
-
|
|
380
|
+
Object.keys(behavior).forEach(function (key) {
|
|
381
|
+
// 不支持的属性
|
|
382
|
+
if (nonsupport.has(key)) {
|
|
383
|
+
var advise = nonsupport.get(key);
|
|
384
|
+
return report(advise);
|
|
385
|
+
}
|
|
386
386
|
|
|
387
|
-
|
|
388
|
-
|
|
387
|
+
if (behaviorMap.has(key)) {
|
|
388
|
+
var list = behaviorMap.get(key);
|
|
389
|
+
var value = behavior[key];
|
|
390
|
+
list.push(value);
|
|
389
391
|
}
|
|
390
|
-
}
|
|
391
|
-
'': obj
|
|
392
|
-
}, '', obj, 0);
|
|
392
|
+
});
|
|
393
393
|
}
|
|
394
394
|
|
|
395
395
|
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
|
|
@@ -480,7 +480,7 @@ function withWeapp(weappConf) {
|
|
|
480
480
|
_this.didHides = [];
|
|
481
481
|
_this.didShows = [];
|
|
482
482
|
_this.willUnmounts = [];
|
|
483
|
-
_this.
|
|
483
|
+
_this.eventDestroyList = [];
|
|
484
484
|
_this.current = getCurrentInstance();
|
|
485
485
|
_this.taroGlobalData = Object.create(null);
|
|
486
486
|
|
|
@@ -622,8 +622,8 @@ function withWeapp(weappConf) {
|
|
|
622
622
|
|
|
623
623
|
for (var confKey in options) {
|
|
624
624
|
// 不支持的属性
|
|
625
|
-
if (
|
|
626
|
-
var advise =
|
|
625
|
+
if (nonsupport.has(confKey)) {
|
|
626
|
+
var advise = nonsupport.get(confKey);
|
|
627
627
|
report(advise);
|
|
628
628
|
}
|
|
629
629
|
|
|
@@ -801,8 +801,8 @@ function withWeapp(weappConf) {
|
|
|
801
801
|
key: "initLifeCycles",
|
|
802
802
|
value: function initLifeCycles(lifecycleName, lifecycle) {
|
|
803
803
|
// 不支持的生命周期
|
|
804
|
-
if (
|
|
805
|
-
var advise =
|
|
804
|
+
if (nonsupport.has(lifecycleName)) {
|
|
805
|
+
var advise = nonsupport.get(lifecycleName);
|
|
806
806
|
return report(advise);
|
|
807
807
|
}
|
|
808
808
|
|
|
@@ -869,7 +869,7 @@ function withWeapp(weappConf) {
|
|
|
869
869
|
cb = cb.bind(this);
|
|
870
870
|
(router === null || router === void 0 ? void 0 : router[lifecycleName]) && eventCenter.on(router[lifecycleName], cb); // unMount 时需要取消事件监听
|
|
871
871
|
|
|
872
|
-
this.
|
|
872
|
+
this.eventDestroyList.push(function () {
|
|
873
873
|
return eventCenter.off(router[lifecycleName], cb);
|
|
874
874
|
});
|
|
875
875
|
}
|
|
@@ -1011,7 +1011,7 @@ function withWeapp(weappConf) {
|
|
|
1011
1011
|
}, {
|
|
1012
1012
|
key: "componentWillUnmount",
|
|
1013
1013
|
value: function componentWillUnmount() {
|
|
1014
|
-
this.
|
|
1014
|
+
this.eventDestroyList.forEach(function (fn) {
|
|
1015
1015
|
return fn();
|
|
1016
1016
|
});
|
|
1017
1017
|
this.safeExecute(_get(_getPrototypeOf(BaseComponent.prototype), "componentWillUnmount", this));
|
|
@@ -1070,22 +1070,22 @@ function withWeapp(weappConf) {
|
|
|
1070
1070
|
}, {
|
|
1071
1071
|
key: "selectComponent",
|
|
1072
1072
|
value: function selectComponent() {
|
|
1073
|
-
report(
|
|
1073
|
+
report(nonsupport.get('selectComponent'));
|
|
1074
1074
|
}
|
|
1075
1075
|
}, {
|
|
1076
1076
|
key: "selectAllComponents",
|
|
1077
1077
|
value: function selectAllComponents() {
|
|
1078
|
-
report(
|
|
1078
|
+
report(nonsupport.get('selectAllComponents'));
|
|
1079
1079
|
}
|
|
1080
1080
|
}, {
|
|
1081
1081
|
key: "selectOwnerComponent",
|
|
1082
1082
|
value: function selectOwnerComponent() {
|
|
1083
|
-
report(
|
|
1083
|
+
report(nonsupport.get('selectOwnerComponent'));
|
|
1084
1084
|
}
|
|
1085
1085
|
}, {
|
|
1086
1086
|
key: "groupSetData",
|
|
1087
1087
|
value: function groupSetData() {
|
|
1088
|
-
report(
|
|
1088
|
+
report(nonsupport.get('groupSetData'));
|
|
1089
1089
|
}
|
|
1090
1090
|
}]);
|
|
1091
1091
|
|