@tarojs/with-weapp 4.0.1-alpha.0 → 4.0.1
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/LICENSE +8 -8
- package/dist/index.esm.js +895 -847
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +908 -846
- package/dist/index.js.map +1 -1
- package/dist/with-weapp.js +901 -850
- package/dist/with-weapp.js.map +1 -1
- package/package.json +28 -18
- package/src/index.ts +0 -25
package/dist/index.js
CHANGED
|
@@ -2,114 +2,138 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
+
var _defineProperty = require('@babel/runtime/helpers/defineProperty');
|
|
6
|
+
var _toConsumableArray = require('@babel/runtime/helpers/toConsumableArray');
|
|
7
|
+
var _slicedToArray = require('@babel/runtime/helpers/slicedToArray');
|
|
8
|
+
var _classCallCheck = require('@babel/runtime/helpers/classCallCheck');
|
|
9
|
+
var _createClass = require('@babel/runtime/helpers/createClass');
|
|
10
|
+
var _assertThisInitialized = require('@babel/runtime/helpers/assertThisInitialized');
|
|
11
|
+
var _get = require('@babel/runtime/helpers/get');
|
|
12
|
+
var _inherits = require('@babel/runtime/helpers/inherits');
|
|
13
|
+
var _possibleConstructorReturn = require('@babel/runtime/helpers/possibleConstructorReturn');
|
|
14
|
+
var _getPrototypeOf = require('@babel/runtime/helpers/getPrototypeOf');
|
|
15
|
+
var _typeof = require('@babel/runtime/helpers/typeof');
|
|
5
16
|
var runtime = require('@tarojs/runtime');
|
|
6
17
|
var taro = require('@tarojs/taro');
|
|
7
18
|
|
|
8
|
-
|
|
19
|
+
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
9
20
|
|
|
10
|
-
|
|
21
|
+
var _defineProperty__default = /*#__PURE__*/_interopDefaultLegacy(_defineProperty);
|
|
22
|
+
var _toConsumableArray__default = /*#__PURE__*/_interopDefaultLegacy(_toConsumableArray);
|
|
23
|
+
var _slicedToArray__default = /*#__PURE__*/_interopDefaultLegacy(_slicedToArray);
|
|
24
|
+
var _classCallCheck__default = /*#__PURE__*/_interopDefaultLegacy(_classCallCheck);
|
|
25
|
+
var _createClass__default = /*#__PURE__*/_interopDefaultLegacy(_createClass);
|
|
26
|
+
var _assertThisInitialized__default = /*#__PURE__*/_interopDefaultLegacy(_assertThisInitialized);
|
|
27
|
+
var _get__default = /*#__PURE__*/_interopDefaultLegacy(_get);
|
|
28
|
+
var _inherits__default = /*#__PURE__*/_interopDefaultLegacy(_inherits);
|
|
29
|
+
var _possibleConstructorReturn__default = /*#__PURE__*/_interopDefaultLegacy(_possibleConstructorReturn);
|
|
30
|
+
var _getPrototypeOf__default = /*#__PURE__*/_interopDefaultLegacy(_getPrototypeOf);
|
|
31
|
+
var _typeof__default = /*#__PURE__*/_interopDefaultLegacy(_typeof);
|
|
11
32
|
|
|
12
|
-
|
|
13
|
-
|
|
33
|
+
var json = JSON;
|
|
34
|
+
var clone = function clone(obj) {
|
|
35
|
+
return json.parse(stringify(obj));
|
|
14
36
|
};
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
37
|
+
var isArray = Array.isArray || function (x) {
|
|
38
|
+
return {}.toString.call(x) === '[object Array]';
|
|
39
|
+
};
|
|
40
|
+
var objectKeys = Object.keys || function (obj) {
|
|
41
|
+
var has = Object.prototype.hasOwnProperty || function () {
|
|
42
|
+
return true;
|
|
43
|
+
};
|
|
44
|
+
var keys = [];
|
|
45
|
+
for (var key in obj) {
|
|
20
46
|
if (has.call(obj, key)) keys.push(key);
|
|
21
47
|
}
|
|
22
|
-
return keys
|
|
48
|
+
return keys;
|
|
23
49
|
};
|
|
24
|
-
|
|
25
|
-
function stringify (obj, opts) {
|
|
50
|
+
function stringify(obj, opts) {
|
|
26
51
|
if (!opts) opts = {};
|
|
27
|
-
if (typeof opts === 'function') opts = {
|
|
28
|
-
|
|
52
|
+
if (typeof opts === 'function') opts = {
|
|
53
|
+
cmp: opts
|
|
54
|
+
};
|
|
55
|
+
var space = opts.space || '';
|
|
29
56
|
if (typeof space === 'number') space = Array(space + 1).join(' ');
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
57
|
+
var cycles = typeof opts.cycles === 'boolean' ? opts.cycles : false;
|
|
58
|
+
var replacer = opts.replacer || function (key, value) {
|
|
59
|
+
return value;
|
|
60
|
+
};
|
|
61
|
+
var cmp = opts.cmp && function (f) {
|
|
34
62
|
return function (node) {
|
|
35
63
|
return function (a, b) {
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
64
|
+
var aobj = {
|
|
65
|
+
key: a,
|
|
66
|
+
value: node[a]
|
|
67
|
+
};
|
|
68
|
+
var bobj = {
|
|
69
|
+
key: b,
|
|
70
|
+
value: node[b]
|
|
71
|
+
};
|
|
72
|
+
return f(aobj, bobj);
|
|
73
|
+
};
|
|
74
|
+
};
|
|
75
|
+
}(opts.cmp);
|
|
76
|
+
var seen = [];
|
|
77
|
+
return function stringify(parent, key, node, level) {
|
|
78
|
+
var indent = space ? '\n' + new Array(level + 1).join(space) : '';
|
|
79
|
+
var colonSeparator = space ? ': ' : ':';
|
|
48
80
|
if (node && node.toJSON && typeof node.toJSON === 'function') {
|
|
49
81
|
node = node.toJSON();
|
|
50
82
|
}
|
|
51
|
-
|
|
52
83
|
node = replacer.call(parent, key, node);
|
|
53
|
-
|
|
54
84
|
if (node === undefined) {
|
|
55
|
-
return
|
|
85
|
+
return;
|
|
56
86
|
}
|
|
57
|
-
if (
|
|
58
|
-
return json.stringify(node)
|
|
87
|
+
if (_typeof__default["default"](node) !== 'object' || node === null) {
|
|
88
|
+
return json.stringify(node);
|
|
59
89
|
}
|
|
60
90
|
if (isArray(node)) {
|
|
61
|
-
|
|
62
|
-
for (
|
|
63
|
-
|
|
91
|
+
var out = [];
|
|
92
|
+
for (var i = 0; i < node.length; i++) {
|
|
93
|
+
var item = stringify(node, i, node[i], level + 1) || json.stringify(null);
|
|
64
94
|
out.push(indent + space + item);
|
|
65
95
|
}
|
|
66
|
-
return '[' + out.join(',') + indent + ']'
|
|
96
|
+
return '[' + out.join(',') + indent + ']';
|
|
67
97
|
} else {
|
|
68
98
|
if (seen.indexOf(node) !== -1) {
|
|
69
|
-
if (cycles) return json.stringify('__cycle__')
|
|
70
|
-
throw new TypeError('Converting circular structure to JSON')
|
|
99
|
+
if (cycles) return json.stringify('__cycle__');
|
|
100
|
+
throw new TypeError('Converting circular structure to JSON');
|
|
71
101
|
} else seen.push(node);
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
const keyValue = json.stringify(key) +
|
|
82
|
-
colonSeparator +
|
|
83
|
-
value;
|
|
84
|
-
|
|
85
|
-
out.push(indent + space + keyValue);
|
|
102
|
+
var keys = objectKeys(node).sort(cmp && cmp(node));
|
|
103
|
+
var _out = [];
|
|
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;
|
|
109
|
+
_out.push(indent + space + keyValue);
|
|
86
110
|
}
|
|
87
111
|
seen.splice(seen.indexOf(node), 1);
|
|
88
|
-
return '{' +
|
|
112
|
+
return '{' + _out.join(',') + indent + '}';
|
|
89
113
|
}
|
|
90
|
-
}
|
|
114
|
+
}({
|
|
115
|
+
'': obj
|
|
116
|
+
}, '', obj, 0);
|
|
91
117
|
}
|
|
92
118
|
|
|
93
119
|
/*eslint-disable*/
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
const result = {};
|
|
120
|
+
var ARRAYTYPE = '[object Array]';
|
|
121
|
+
var OBJECTTYPE = '[object Object]';
|
|
122
|
+
var FUNCTIONTYPE = '[object Function]';
|
|
123
|
+
function diff(current, pre) {
|
|
124
|
+
var result = {};
|
|
100
125
|
syncKeys(current, pre);
|
|
101
126
|
_diff(current, pre, '', result);
|
|
102
|
-
return result
|
|
127
|
+
return result;
|
|
103
128
|
}
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
const rootPreType = type(pre);
|
|
129
|
+
function syncKeys(current, pre) {
|
|
130
|
+
if (current === pre) return;
|
|
131
|
+
var rootCurrentType = type(current);
|
|
132
|
+
var rootPreType = type(pre);
|
|
109
133
|
if (rootCurrentType == OBJECTTYPE && rootPreType == OBJECTTYPE) {
|
|
110
134
|
// if(Object.keys(current).length >= Object.keys(pre).length){
|
|
111
|
-
for (
|
|
112
|
-
|
|
135
|
+
for (var key in pre) {
|
|
136
|
+
var currentValue = current[key];
|
|
113
137
|
if (currentValue === undefined) {
|
|
114
138
|
current[key] = null;
|
|
115
139
|
} else {
|
|
@@ -119,26 +143,25 @@ function syncKeys (current, pre) {
|
|
|
119
143
|
// }
|
|
120
144
|
} else if (rootCurrentType == ARRAYTYPE && rootPreType == ARRAYTYPE) {
|
|
121
145
|
if (current.length >= pre.length) {
|
|
122
|
-
pre.forEach((item, index)
|
|
146
|
+
pre.forEach(function (item, index) {
|
|
123
147
|
syncKeys(current[index], item);
|
|
124
148
|
});
|
|
125
149
|
}
|
|
126
150
|
}
|
|
127
151
|
}
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
const rootPreType = type(pre);
|
|
152
|
+
function _diff(current, pre, path, result) {
|
|
153
|
+
if (current === pre) return;
|
|
154
|
+
var rootCurrentType = type(current);
|
|
155
|
+
var rootPreType = type(pre);
|
|
133
156
|
if (rootCurrentType == OBJECTTYPE) {
|
|
134
157
|
if (rootPreType != OBJECTTYPE || Object.keys(current).length < Object.keys(pre).length) {
|
|
135
158
|
setResult(result, path, current);
|
|
136
159
|
} else {
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
160
|
+
var _loop = function _loop(key) {
|
|
161
|
+
var currentValue = current[key];
|
|
162
|
+
var preValue = pre[key];
|
|
163
|
+
var currentType = type(currentValue);
|
|
164
|
+
var preType = type(preValue);
|
|
142
165
|
if (currentType != ARRAYTYPE && currentType != OBJECTTYPE) {
|
|
143
166
|
if (currentValue != pre[key]) {
|
|
144
167
|
setResult(result, (path == '' ? '' : path + '.') + key, currentValue);
|
|
@@ -150,7 +173,7 @@ function _diff (current, pre, path, result) {
|
|
|
150
173
|
if (currentValue.length < preValue.length) {
|
|
151
174
|
setResult(result, (path == '' ? '' : path + '.') + key, currentValue);
|
|
152
175
|
} else {
|
|
153
|
-
currentValue.forEach((item, index)
|
|
176
|
+
currentValue.forEach(function (item, index) {
|
|
154
177
|
_diff(item, preValue[index], (path == '' ? '' : path + '.') + key + '[' + index + ']', result);
|
|
155
178
|
});
|
|
156
179
|
}
|
|
@@ -159,11 +182,14 @@ function _diff (current, pre, path, result) {
|
|
|
159
182
|
if (preType != OBJECTTYPE || Object.keys(currentValue).length < Object.keys(preValue).length) {
|
|
160
183
|
setResult(result, (path == '' ? '' : path + '.') + key, currentValue);
|
|
161
184
|
} else {
|
|
162
|
-
for (
|
|
185
|
+
for (var subKey in currentValue) {
|
|
163
186
|
_diff(currentValue[subKey], preValue[subKey], (path == '' ? '' : path + '.') + key + '.' + subKey, result);
|
|
164
187
|
}
|
|
165
188
|
}
|
|
166
189
|
}
|
|
190
|
+
};
|
|
191
|
+
for (var key in current) {
|
|
192
|
+
_loop(key);
|
|
167
193
|
}
|
|
168
194
|
}
|
|
169
195
|
} else if (rootCurrentType == ARRAYTYPE) {
|
|
@@ -173,7 +199,7 @@ function _diff (current, pre, path, result) {
|
|
|
173
199
|
if (current.length < pre.length) {
|
|
174
200
|
setResult(result, path, current);
|
|
175
201
|
} else {
|
|
176
|
-
current.forEach((item, index)
|
|
202
|
+
current.forEach(function (item, index) {
|
|
177
203
|
_diff(item, pre[index], path + '[' + index + ']', result);
|
|
178
204
|
});
|
|
179
205
|
}
|
|
@@ -182,853 +208,889 @@ function _diff (current, pre, path, result) {
|
|
|
182
208
|
setResult(result, path, current);
|
|
183
209
|
}
|
|
184
210
|
}
|
|
185
|
-
|
|
186
|
-
function setResult (result, k, v) {
|
|
211
|
+
function setResult(result, k, v) {
|
|
187
212
|
if (type(v) != FUNCTIONTYPE) {
|
|
188
213
|
result[k] = v;
|
|
189
214
|
}
|
|
190
215
|
}
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
return Object.prototype.toString.call(obj)
|
|
216
|
+
function type(obj) {
|
|
217
|
+
return Object.prototype.toString.call(obj);
|
|
194
218
|
}
|
|
195
219
|
|
|
220
|
+
var _lifecycleMap;
|
|
196
221
|
var TaroLifeCycles;
|
|
197
222
|
(function (TaroLifeCycles) {
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
223
|
+
TaroLifeCycles["WillMount"] = "componentWillMount";
|
|
224
|
+
TaroLifeCycles["DidMount"] = "componentDidMount";
|
|
225
|
+
TaroLifeCycles["DidShow"] = "componentDidShow";
|
|
226
|
+
TaroLifeCycles["DidHide"] = "componentDidHide";
|
|
227
|
+
TaroLifeCycles["WillUnmount"] = "componentWillUnmount";
|
|
203
228
|
})(TaroLifeCycles || (TaroLifeCycles = {}));
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
};
|
|
211
|
-
const lifecycles = new Set(['ready']);
|
|
212
|
-
for (const key in lifecycleMap) {
|
|
213
|
-
const lifecycle = lifecycleMap[key];
|
|
214
|
-
lifecycle.forEach(l => lifecycles.add(l));
|
|
229
|
+
var lifecycleMap = (_lifecycleMap = {}, _defineProperty__default["default"](_lifecycleMap, TaroLifeCycles.WillMount, ['created']), _defineProperty__default["default"](_lifecycleMap, TaroLifeCycles.DidMount, ['attached']), _defineProperty__default["default"](_lifecycleMap, TaroLifeCycles.DidShow, ['onShow']), _defineProperty__default["default"](_lifecycleMap, TaroLifeCycles.DidHide, ['onHide']), _defineProperty__default["default"](_lifecycleMap, TaroLifeCycles.WillUnmount, ['detached', 'onUnload']), _lifecycleMap);
|
|
230
|
+
var lifecycles = new Set(['ready']);
|
|
231
|
+
for (var key in lifecycleMap) {
|
|
232
|
+
var lifecycle = lifecycleMap[key];
|
|
233
|
+
lifecycle.forEach(function (l) {
|
|
234
|
+
return lifecycles.add(l);
|
|
235
|
+
});
|
|
215
236
|
}
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
'onReachBottom',
|
|
219
|
-
'onShareAppMessage',
|
|
220
|
-
'onShareTimeline',
|
|
221
|
-
'onAddToFavorites',
|
|
222
|
-
'onPageScroll',
|
|
223
|
-
'onResize',
|
|
224
|
-
'onTabItemTap'
|
|
225
|
-
];
|
|
226
|
-
const appOptions = [
|
|
227
|
-
'onLaunch',
|
|
228
|
-
'onShow',
|
|
229
|
-
'onHide',
|
|
230
|
-
'onError',
|
|
231
|
-
'onPageNotFound',
|
|
232
|
-
'onUnhandledRejection',
|
|
233
|
-
'onThemeChange'
|
|
234
|
-
];
|
|
237
|
+
var uniquePageLifecycle = ['onPullDownRefresh', 'onReachBottom', 'onShareAppMessage', 'onShareTimeline', 'onAddToFavorites', 'onPageScroll', 'onResize', 'onTabItemTap'];
|
|
238
|
+
var appOptions = ['onLaunch', 'onShow', 'onHide', 'onError', 'onPageNotFound', 'onUnhandledRejection', 'onThemeChange'];
|
|
235
239
|
|
|
236
240
|
/**
|
|
237
241
|
* Simple bind, faster than native
|
|
238
242
|
*/
|
|
239
243
|
function bind(fn /*: Function */, ctx /*: Object */) {
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
return boundFn;
|
|
244
|
+
if (!fn) return false;
|
|
245
|
+
function boundFn(a) {
|
|
246
|
+
var l /*: number */ = arguments.length;
|
|
247
|
+
return l ? l > 1 ? fn.apply(ctx, arguments) : fn.call(ctx, a) : fn.call(ctx);
|
|
248
|
+
}
|
|
249
|
+
// record original fn length
|
|
250
|
+
boundFn._length = fn.length;
|
|
251
|
+
return boundFn;
|
|
249
252
|
}
|
|
250
253
|
function isEqual(obj1, obj2) {
|
|
251
|
-
|
|
254
|
+
return JSON.stringify(obj1) === JSON.stringify(obj2);
|
|
252
255
|
}
|
|
253
256
|
function safeGet(obj, propsArg, defaultValue) {
|
|
257
|
+
if (!obj) {
|
|
258
|
+
return defaultValue;
|
|
259
|
+
}
|
|
260
|
+
var props, prop;
|
|
261
|
+
if (Array.isArray(propsArg)) {
|
|
262
|
+
props = propsArg.slice(0);
|
|
263
|
+
}
|
|
264
|
+
if (typeof propsArg === 'string') {
|
|
265
|
+
props = propsArg.replace(/\[(.+?)\]/g, '.$1');
|
|
266
|
+
props = props.split('.');
|
|
267
|
+
}
|
|
268
|
+
if (_typeof__default["default"](propsArg) === 'symbol') {
|
|
269
|
+
props = [propsArg];
|
|
270
|
+
}
|
|
271
|
+
if (!Array.isArray(props)) {
|
|
272
|
+
throw new Error('props arg must be an array, a string or a symbol');
|
|
273
|
+
}
|
|
274
|
+
while (props.length) {
|
|
275
|
+
prop = props.shift();
|
|
254
276
|
if (!obj) {
|
|
255
|
-
|
|
256
|
-
}
|
|
257
|
-
let props, prop;
|
|
258
|
-
if (Array.isArray(propsArg)) {
|
|
259
|
-
props = propsArg.slice(0);
|
|
260
|
-
}
|
|
261
|
-
if (typeof propsArg === 'string') {
|
|
262
|
-
props = propsArg.replace(/\[(.+?)\]/g, '.$1');
|
|
263
|
-
props = props.split('.');
|
|
264
|
-
}
|
|
265
|
-
if (typeof propsArg === 'symbol') {
|
|
266
|
-
props = [propsArg];
|
|
277
|
+
return defaultValue;
|
|
267
278
|
}
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
while (props.length) {
|
|
272
|
-
prop = props.shift();
|
|
273
|
-
if (!obj) {
|
|
274
|
-
return defaultValue;
|
|
275
|
-
}
|
|
276
|
-
obj = obj[prop];
|
|
277
|
-
if (obj === undefined) {
|
|
278
|
-
return defaultValue;
|
|
279
|
-
}
|
|
279
|
+
obj = obj[prop];
|
|
280
|
+
if (obj === undefined) {
|
|
281
|
+
return defaultValue;
|
|
280
282
|
}
|
|
281
|
-
|
|
283
|
+
}
|
|
284
|
+
return obj;
|
|
282
285
|
}
|
|
283
286
|
function safeSet(obj, props, value) {
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
287
|
+
if (typeof props === 'string') {
|
|
288
|
+
props = props.replace(/\[(.+?)\]/g, '.$1');
|
|
289
|
+
props = props.split('.');
|
|
290
|
+
}
|
|
291
|
+
if (_typeof__default["default"](props) === 'symbol') {
|
|
292
|
+
props = [props];
|
|
293
|
+
}
|
|
294
|
+
var lastProp = props.pop();
|
|
295
|
+
if (!lastProp) {
|
|
296
|
+
return false;
|
|
297
|
+
}
|
|
298
|
+
var thisProp;
|
|
299
|
+
while (thisProp = props.shift()) {
|
|
300
|
+
if (typeof obj[thisProp] === 'undefined') {
|
|
301
|
+
obj[thisProp] = {};
|
|
290
302
|
}
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
303
|
+
// 直接按路径修改 this.state 可能会导致 nextProps 也被修改
|
|
304
|
+
// 因此按路径寻找时,每一层都复制一遍
|
|
305
|
+
if (Array.isArray(obj[thisProp])) {
|
|
306
|
+
obj[thisProp] = _toConsumableArray__default["default"](obj[thisProp]);
|
|
307
|
+
} else if (_typeof__default["default"](obj[thisProp]) === 'object') {
|
|
308
|
+
obj[thisProp] = Object.assign({}, obj[thisProp]);
|
|
294
309
|
}
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
obj[thisProp] = {};
|
|
299
|
-
}
|
|
300
|
-
// 直接按路径修改 this.state 可能会导致 nextProps 也被修改
|
|
301
|
-
// 因此按路径寻找时,每一层都复制一遍
|
|
302
|
-
if (Array.isArray(obj[thisProp])) {
|
|
303
|
-
obj[thisProp] = [...obj[thisProp]];
|
|
304
|
-
}
|
|
305
|
-
else if (typeof obj[thisProp] === 'object') {
|
|
306
|
-
obj[thisProp] = Object.assign({}, obj[thisProp]);
|
|
307
|
-
}
|
|
308
|
-
obj = obj[thisProp];
|
|
309
|
-
if (!obj || typeof obj !== 'object') {
|
|
310
|
-
return false;
|
|
311
|
-
}
|
|
310
|
+
obj = obj[thisProp];
|
|
311
|
+
if (!obj || _typeof__default["default"](obj) !== 'object') {
|
|
312
|
+
return false;
|
|
312
313
|
}
|
|
313
|
-
|
|
314
|
-
|
|
314
|
+
}
|
|
315
|
+
obj[lastProp] = value;
|
|
316
|
+
return true;
|
|
315
317
|
}
|
|
316
318
|
function report(msg) {
|
|
317
|
-
|
|
319
|
+
console.warn('[Taro Convert Warning] ' + msg);
|
|
318
320
|
}
|
|
319
|
-
|
|
320
|
-
['onError', '不支持 App 的 onError 生命周期方法。'],
|
|
321
|
-
['onPageNotFound', '不支持 App 的 onPageNotFound 生命周期方法。'],
|
|
322
|
-
['onUnhandledRejection', '不支持 App 的 onUnhandledRejection 生命周期方法。'],
|
|
323
|
-
['onThemeChange', '不支持 App 的 onThemeChange 生命周期方法。'],
|
|
324
|
-
['moved', '不支持自定义组件的 moved 生命周期。'],
|
|
325
|
-
['externalClasses', '不支持自定义组件的 externalClasses 功能。'],
|
|
326
|
-
['relations', '不支持自定义组件的 relations 功能。'],
|
|
327
|
-
['options', '不支持自定义组件的 options 功能。'],
|
|
328
|
-
['definitionFilter', '不支持自定义组件的 definitionFilter 功能。'],
|
|
329
|
-
['selectComponent', 'selectComponent 方法产生不到目标效果,请使用 React 的 ref 进行重构。'],
|
|
330
|
-
['selectAllComponents', 'selectAllComponents 方法产生不到目标效果,请使用 React 的 ref 进行重构。'],
|
|
331
|
-
['selectOwnerComponent', 'selectOwnerComponent 方法产生不到目标效果,请使用 React 语法重构。'],
|
|
332
|
-
['groupSetData', 'groupSetData 方法产生不到目标效果,请使用 React 语法重构。']
|
|
333
|
-
]);
|
|
321
|
+
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 语法重构。']]);
|
|
334
322
|
function flattenBehaviors(behavior, behaviorMap) {
|
|
335
|
-
|
|
336
|
-
|
|
323
|
+
if (typeof behavior === 'string') {
|
|
324
|
+
return report("\u4E0D\u652F\u6301\u4F7F\u7528\u5185\u7F6E Behavior: [".concat(behavior, "]"));
|
|
325
|
+
}
|
|
326
|
+
var subBehaviors = behavior.behaviors;
|
|
327
|
+
if (subBehaviors === null || subBehaviors === void 0 ? void 0 : subBehaviors.length) {
|
|
328
|
+
subBehaviors.forEach(function (subBehavior) {
|
|
329
|
+
return flattenBehaviors(subBehavior, behaviorMap);
|
|
330
|
+
});
|
|
331
|
+
}
|
|
332
|
+
Object.keys(behavior).forEach(function (key) {
|
|
333
|
+
// 不支持的属性
|
|
334
|
+
if (nonsupport.has(key)) {
|
|
335
|
+
var advise = nonsupport.get(key);
|
|
336
|
+
return report(advise);
|
|
337
337
|
}
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
338
|
+
if (behaviorMap.has(key)) {
|
|
339
|
+
var list = behaviorMap.get(key);
|
|
340
|
+
var value = behavior[key];
|
|
341
|
+
list.push(value);
|
|
341
342
|
}
|
|
342
|
-
|
|
343
|
-
// 不支持的属性
|
|
344
|
-
if (nonsupport.has(key)) {
|
|
345
|
-
const advise = nonsupport.get(key);
|
|
346
|
-
return report(advise);
|
|
347
|
-
}
|
|
348
|
-
if (behaviorMap.has(key)) {
|
|
349
|
-
const list = behaviorMap.get(key);
|
|
350
|
-
const value = behavior[key];
|
|
351
|
-
list.push(value);
|
|
352
|
-
}
|
|
353
|
-
});
|
|
343
|
+
});
|
|
354
344
|
}
|
|
355
345
|
|
|
356
346
|
/**
|
|
357
347
|
* 该模块仅存放 convert 转换时用到的工具函数或变量
|
|
358
348
|
*/
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
}
|
|
365
|
-
},
|
|
366
|
-
getOptionsFromCache: function () {
|
|
367
|
-
return this.cacheOptions;
|
|
349
|
+
var cacheOptions = {
|
|
350
|
+
cacheOptions: {},
|
|
351
|
+
setOptionsToCache: function setOptionsToCache(options) {
|
|
352
|
+
if (Object.keys(options).length !== 0) {
|
|
353
|
+
this.cacheOptions = options;
|
|
368
354
|
}
|
|
355
|
+
},
|
|
356
|
+
getOptionsFromCache: function getOptionsFromCache() {
|
|
357
|
+
return this.cacheOptions;
|
|
358
|
+
}
|
|
369
359
|
};
|
|
370
360
|
function toCamelCase(s) {
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
nextCap = true;
|
|
380
|
-
}
|
|
361
|
+
var camel = '';
|
|
362
|
+
var nextCap = false;
|
|
363
|
+
for (var i = 0; i < s.length; i++) {
|
|
364
|
+
if (s[i] !== '-') {
|
|
365
|
+
camel += nextCap ? s[i].toUpperCase() : s[i];
|
|
366
|
+
nextCap = false;
|
|
367
|
+
} else {
|
|
368
|
+
nextCap = true;
|
|
381
369
|
}
|
|
382
|
-
|
|
370
|
+
}
|
|
371
|
+
return camel;
|
|
383
372
|
}
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
}
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
}
|
|
373
|
+
var convertToArray = function convertToArray(value, fn) {
|
|
374
|
+
if (value instanceof Array) {
|
|
375
|
+
return value.map(fn);
|
|
376
|
+
} else if (typeof value === 'number') {
|
|
377
|
+
return Array.from({
|
|
378
|
+
length: value
|
|
379
|
+
}, function (_, index) {
|
|
380
|
+
return index;
|
|
381
|
+
}).map(fn);
|
|
382
|
+
} else if (typeof value === 'string') {
|
|
383
|
+
return Array.from(value).map(fn);
|
|
384
|
+
} else if (_typeof__default["default"](value) === 'object' && value !== null && Object.getPrototypeOf(value) === Object.prototype) {
|
|
385
|
+
var result = Object.keys(value).map(function (item) {
|
|
386
|
+
return fn(value[item], item);
|
|
387
|
+
});
|
|
388
|
+
return result;
|
|
389
|
+
}
|
|
402
390
|
};
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
391
|
+
var getTarget = function getTarget(target, Taro) {
|
|
392
|
+
if (!target) {
|
|
393
|
+
return {
|
|
394
|
+
dataset: {}
|
|
395
|
+
};
|
|
396
|
+
}
|
|
397
|
+
if (Taro.getEnv() === Taro.ENV_TYPE.HARMONYHYBRID || Taro.getEnv() === Taro.ENV_TYPE.WEB) {
|
|
398
|
+
if (target.fullDataset) {
|
|
399
|
+
return {
|
|
400
|
+
dataset: target.fullDataset
|
|
401
|
+
};
|
|
406
402
|
}
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
for (let i = 0; i < targetAttrKeys.length; i++) {
|
|
416
|
-
if (targetAttrKeys[i].startsWith('data-')) {
|
|
417
|
-
fullDataset[toCamelCase(targetAttrKeys[i].replace(/^data-/, '').toLowerCase())] = target[targetAttrKeys[i]];
|
|
418
|
-
}
|
|
419
|
-
}
|
|
420
|
-
target.fullDataset = fullDataset;
|
|
421
|
-
return { dataset: fullDataset };
|
|
403
|
+
var fullDataset = {};
|
|
404
|
+
// 获取元素的所有属性
|
|
405
|
+
var targetAttrKeys = Object.keys(target);
|
|
406
|
+
// 遍历所有属性
|
|
407
|
+
for (var i = 0; i < targetAttrKeys.length; i++) {
|
|
408
|
+
if (targetAttrKeys[i].startsWith('data-')) {
|
|
409
|
+
fullDataset[toCamelCase(targetAttrKeys[i].replace(/^data-/, '').toLowerCase())] = target[targetAttrKeys[i]];
|
|
410
|
+
}
|
|
422
411
|
}
|
|
423
|
-
|
|
412
|
+
target.fullDataset = fullDataset;
|
|
413
|
+
return {
|
|
414
|
+
dataset: fullDataset
|
|
415
|
+
};
|
|
416
|
+
}
|
|
417
|
+
return target;
|
|
424
418
|
};
|
|
425
419
|
|
|
420
|
+
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; } } }; }
|
|
421
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
422
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
423
|
+
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf__default["default"](Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf__default["default"](this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn__default["default"](this, result); }; }
|
|
424
|
+
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
426
425
|
function defineGetter(component, key, getter) {
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
426
|
+
Object.defineProperty(component, key, {
|
|
427
|
+
enumerable: true,
|
|
428
|
+
configurable: true,
|
|
429
|
+
get: function get() {
|
|
430
|
+
if (getter === 'props') {
|
|
431
|
+
return component.props;
|
|
432
|
+
}
|
|
433
|
+
return component.state;
|
|
434
|
+
// return {
|
|
435
|
+
// ...component.state,
|
|
436
|
+
// ...component.props
|
|
437
|
+
// }
|
|
438
|
+
}
|
|
439
|
+
});
|
|
441
440
|
}
|
|
441
|
+
|
|
442
442
|
function propToState(newValue, _oldValue, key) {
|
|
443
|
-
|
|
443
|
+
this.state[key] = newValue;
|
|
444
444
|
}
|
|
445
445
|
function isFunction(o) {
|
|
446
|
-
|
|
446
|
+
return typeof o === 'function';
|
|
447
447
|
}
|
|
448
|
-
function withWeapp(weappConf
|
|
449
|
-
|
|
450
|
-
|
|
448
|
+
function withWeapp(weappConf) {
|
|
449
|
+
var isApp = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
450
|
+
if (_typeof__default["default"](weappConf) === 'object' && Object.keys(weappConf).length === 0) {
|
|
451
|
+
report('withWeapp 请传入“App/页面/组件“的配置对象。如果原生写法使用了基类,请将基类组合后的配置对象传入,详情请参考文档。');
|
|
452
|
+
}
|
|
453
|
+
return function (ConnectComponent) {
|
|
454
|
+
var _a;
|
|
455
|
+
var behaviorMap = new Map([['properties', []], ['data', []], ['methods', []], ['created', []], ['attached', []], ['ready', []], ['detached', []], ['lifetimes', []]]);
|
|
456
|
+
var behaviorProperties = {};
|
|
457
|
+
if ((_a = weappConf.behaviors) === null || _a === void 0 ? void 0 : _a.length) {
|
|
458
|
+
var behaviors = weappConf.behaviors;
|
|
459
|
+
behaviors.forEach(function (behavior) {
|
|
460
|
+
return flattenBehaviors(behavior, behaviorMap);
|
|
461
|
+
});
|
|
462
|
+
var propertiesList = behaviorMap.get('properties');
|
|
463
|
+
if (propertiesList.length) {
|
|
464
|
+
propertiesList.forEach(function (property) {
|
|
465
|
+
Object.assign(behaviorProperties, property);
|
|
466
|
+
});
|
|
467
|
+
Object.keys(behaviorProperties).forEach(function (propName) {
|
|
468
|
+
var propValue = behaviorProperties[propName];
|
|
469
|
+
if (!weappConf.properties) {
|
|
470
|
+
weappConf.properties = {};
|
|
471
|
+
}
|
|
472
|
+
if (!weappConf.properties.hasOwnProperty(propName)) {
|
|
473
|
+
if (propValue && _typeof__default["default"](propValue) === 'object' && propValue.value) {
|
|
474
|
+
propValue.value = clone(propValue.value);
|
|
475
|
+
}
|
|
476
|
+
weappConf.properties[propName] = propValue;
|
|
477
|
+
}
|
|
478
|
+
});
|
|
479
|
+
}
|
|
451
480
|
}
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
]
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
481
|
+
var BaseComponent = /*#__PURE__*/function (_ConnectComponent) {
|
|
482
|
+
_inherits__default["default"](BaseComponent, _ConnectComponent);
|
|
483
|
+
var _super = _createSuper(BaseComponent);
|
|
484
|
+
function BaseComponent(props) {
|
|
485
|
+
var _this;
|
|
486
|
+
_classCallCheck__default["default"](this, BaseComponent);
|
|
487
|
+
_this = _super.call(this, props);
|
|
488
|
+
_this._observeProps = [];
|
|
489
|
+
// mixins 可以多次调用生命周期
|
|
490
|
+
_this.willMounts = [];
|
|
491
|
+
_this.didMounts = [];
|
|
492
|
+
_this.didHides = [];
|
|
493
|
+
_this.didShows = [];
|
|
494
|
+
_this.willUnmounts = [];
|
|
495
|
+
_this.eventDestroyList = [];
|
|
496
|
+
_this.current = runtime.getCurrentInstance();
|
|
497
|
+
_this.taroGlobalData = Object.create(null);
|
|
498
|
+
_this.safeExecute = function (func) {
|
|
499
|
+
for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
500
|
+
args[_key - 1] = arguments[_key];
|
|
501
|
+
}
|
|
502
|
+
if (isFunction(func)) func.apply(_assertThisInitialized__default["default"](_this), args);
|
|
503
|
+
};
|
|
504
|
+
_this.setData = function (obj, callback) {
|
|
505
|
+
var oldState;
|
|
506
|
+
if (_this.observers && Object.keys(Object.keys(_this.observers))) {
|
|
507
|
+
oldState = clone(_this.state);
|
|
508
|
+
}
|
|
509
|
+
Object.keys(obj).forEach(function (key) {
|
|
510
|
+
safeSet(_this.state, key, obj[key]);
|
|
511
|
+
});
|
|
512
|
+
_this.setState(_this.state, function () {
|
|
513
|
+
_this.triggerObservers(_this.state, oldState);
|
|
514
|
+
if (callback) {
|
|
515
|
+
callback.call(_assertThisInitialized__default["default"](_this));
|
|
485
516
|
}
|
|
517
|
+
});
|
|
518
|
+
};
|
|
519
|
+
_this.triggerEvent = function (eventName, detail, options) {
|
|
520
|
+
if (options) {
|
|
521
|
+
report('triggerEvent 不支持事件选项。');
|
|
522
|
+
}
|
|
523
|
+
// eventName support kebab case
|
|
524
|
+
if (eventName.match(/[a-z]+-[a-z]+/g)) {
|
|
525
|
+
eventName = eventName.replace(/-[a-z]/g, function (match) {
|
|
526
|
+
return match[1].toUpperCase();
|
|
527
|
+
});
|
|
528
|
+
}
|
|
529
|
+
var props = _this.props;
|
|
530
|
+
var dataset = {};
|
|
531
|
+
for (var key in props) {
|
|
532
|
+
if (!key.startsWith('data-')) continue;
|
|
533
|
+
dataset[key.replace(/^data-/, '')] = props[key];
|
|
534
|
+
}
|
|
535
|
+
var func = props["on".concat(eventName[0].toUpperCase()).concat(eventName.slice(1))];
|
|
536
|
+
if (isFunction(func)) {
|
|
537
|
+
func.call(_assertThisInitialized__default["default"](_this), {
|
|
538
|
+
type: eventName,
|
|
539
|
+
detail: detail,
|
|
540
|
+
target: {
|
|
541
|
+
id: props.id || '',
|
|
542
|
+
dataset: dataset
|
|
543
|
+
},
|
|
544
|
+
currentTarget: {
|
|
545
|
+
id: props.id || '',
|
|
546
|
+
dataset: dataset
|
|
547
|
+
}
|
|
548
|
+
});
|
|
549
|
+
}
|
|
550
|
+
};
|
|
551
|
+
_this.hasBehavior = _this.componentMethodsProxy('hasBehavior');
|
|
552
|
+
_this.createSelectorQuery = _this.componentMethodsProxy('createSelectorQuery');
|
|
553
|
+
_this.createIntersectionObserver = _this.componentMethodsProxy('createIntersectionObserver');
|
|
554
|
+
_this.createMediaQueryObserver = _this.componentMethodsProxy('createMediaQueryObserver');
|
|
555
|
+
_this.getRelationNodes = _this.componentMethodsProxy('getRelationNodes');
|
|
556
|
+
_this.getTabBar = _this.componentMethodsProxy('getTabBar');
|
|
557
|
+
_this.getPageId = _this.componentMethodsProxy('getPageId');
|
|
558
|
+
_this.animate = _this.componentMethodsProxy('animate');
|
|
559
|
+
_this.clearAnimation = _this.componentMethodsProxy('clearAnimation');
|
|
560
|
+
_this.setUpdatePerformanceListener = _this.componentMethodsProxy('setUpdatePerformanceListener');
|
|
561
|
+
_this.state = _this.state || {};
|
|
562
|
+
_this.init(weappConf);
|
|
563
|
+
defineGetter(_assertThisInitialized__default["default"](_this), 'data', 'state');
|
|
564
|
+
defineGetter(_assertThisInitialized__default["default"](_this), 'properties', 'props');
|
|
565
|
+
return _this;
|
|
566
|
+
}
|
|
567
|
+
_createClass__default["default"](BaseComponent, [{
|
|
568
|
+
key: "initProps",
|
|
569
|
+
value: function initProps(props) {
|
|
570
|
+
var properties = {};
|
|
571
|
+
for (var propKey in props) {
|
|
572
|
+
if (props.hasOwnProperty(propKey)) {
|
|
573
|
+
var propValue = props[propKey];
|
|
574
|
+
// propValue 可能是 null, 构造函数, 对象
|
|
575
|
+
var observers = [propToState];
|
|
576
|
+
if (propValue === null || propValue === undefined) {
|
|
577
|
+
// propValue为null、undefined情况
|
|
578
|
+
properties[propKey] = null;
|
|
579
|
+
} else if (isFunction(propValue)) {
|
|
580
|
+
// propValue为Function,即Array、String、Boolean等情况时
|
|
581
|
+
if (propValue.name === 'Array') {
|
|
582
|
+
properties[propKey] = [];
|
|
583
|
+
} else if (propValue.name === 'String') {
|
|
584
|
+
properties[propKey] = '';
|
|
585
|
+
} else if (propValue.name === 'Boolean') {
|
|
586
|
+
properties[propKey] = false;
|
|
587
|
+
} else if (propValue.name === 'Number') {
|
|
588
|
+
properties[propKey] = 0;
|
|
589
|
+
} else {
|
|
590
|
+
properties[propKey] = null;
|
|
591
|
+
}
|
|
592
|
+
} else if (_typeof__default["default"](propValue) === 'object') {
|
|
593
|
+
// propValue为对象时
|
|
594
|
+
properties[propKey] = propValue.value;
|
|
595
|
+
if (propValue.observer) {
|
|
596
|
+
observers.push(propValue.observer);
|
|
597
|
+
}
|
|
598
|
+
} else {
|
|
599
|
+
properties[propKey] = null;
|
|
600
|
+
}
|
|
601
|
+
this._observeProps.push({
|
|
602
|
+
name: propKey,
|
|
603
|
+
observers: observers
|
|
604
|
+
});
|
|
605
|
+
}
|
|
606
|
+
}
|
|
607
|
+
this.state = Object.assign(Object.assign({}, properties), this.state);
|
|
486
608
|
}
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
}
|
|
509
|
-
Object.keys(obj).forEach(key => {
|
|
510
|
-
safeSet(this.state, key, obj[key]);
|
|
511
|
-
});
|
|
512
|
-
this.setState(this.state, () => {
|
|
513
|
-
this.triggerObservers(this.state, oldState);
|
|
514
|
-
if (callback) {
|
|
515
|
-
callback.call(this);
|
|
516
|
-
}
|
|
609
|
+
}, {
|
|
610
|
+
key: "init",
|
|
611
|
+
value: function init(options) {
|
|
612
|
+
var _this2 = this;
|
|
613
|
+
var _a, _b, _c;
|
|
614
|
+
// 处理 Behaviors
|
|
615
|
+
if ((_a = options.behaviors) === null || _a === void 0 ? void 0 : _a.length) {
|
|
616
|
+
var _iterator = _createForOfIteratorHelper(behaviorMap.entries()),
|
|
617
|
+
_step;
|
|
618
|
+
try {
|
|
619
|
+
var _loop = function _loop() {
|
|
620
|
+
var _step$value = _slicedToArray__default["default"](_step.value, 2),
|
|
621
|
+
key = _step$value[0],
|
|
622
|
+
list = _step$value[1];
|
|
623
|
+
switch (key) {
|
|
624
|
+
case 'created':
|
|
625
|
+
case 'attached':
|
|
626
|
+
case 'detached':
|
|
627
|
+
case 'ready':
|
|
628
|
+
list.forEach(function (fn) {
|
|
629
|
+
return _this2.initLifeCycles(key, fn);
|
|
517
630
|
});
|
|
518
|
-
|
|
519
|
-
this.triggerEvent = (eventName, detail, options) => {
|
|
520
|
-
if (options) {
|
|
521
|
-
report('triggerEvent 不支持事件选项。');
|
|
522
|
-
}
|
|
523
|
-
// eventName support kebab case
|
|
524
|
-
if (eventName.match(/[a-z]+-[a-z]+/g)) {
|
|
525
|
-
eventName = eventName.replace(/-[a-z]/g, function (match) {
|
|
526
|
-
return match[1].toUpperCase();
|
|
527
|
-
});
|
|
528
|
-
}
|
|
529
|
-
const props = this.props;
|
|
530
|
-
const dataset = {};
|
|
531
|
-
for (const key in props) {
|
|
532
|
-
if (!key.startsWith('data-'))
|
|
533
|
-
continue;
|
|
534
|
-
dataset[key.replace(/^data-/, '')] = props[key];
|
|
535
|
-
}
|
|
536
|
-
const func = props[`on${eventName[0].toUpperCase()}${eventName.slice(1)}`];
|
|
537
|
-
if (isFunction(func)) {
|
|
538
|
-
func.call(this, {
|
|
539
|
-
type: eventName,
|
|
540
|
-
detail,
|
|
541
|
-
target: {
|
|
542
|
-
id: props.id || '',
|
|
543
|
-
dataset
|
|
544
|
-
},
|
|
545
|
-
currentTarget: {
|
|
546
|
-
id: props.id || '',
|
|
547
|
-
dataset
|
|
548
|
-
}
|
|
549
|
-
});
|
|
550
|
-
}
|
|
551
|
-
};
|
|
552
|
-
this.hasBehavior = this.componentMethodsProxy('hasBehavior');
|
|
553
|
-
this.createSelectorQuery = this.componentMethodsProxy('createSelectorQuery');
|
|
554
|
-
this.createIntersectionObserver = this.componentMethodsProxy('createIntersectionObserver');
|
|
555
|
-
this.createMediaQueryObserver = this.componentMethodsProxy('createMediaQueryObserver');
|
|
556
|
-
this.getRelationNodes = this.componentMethodsProxy('getRelationNodes');
|
|
557
|
-
this.getTabBar = this.componentMethodsProxy('getTabBar');
|
|
558
|
-
this.getPageId = this.componentMethodsProxy('getPageId');
|
|
559
|
-
this.animate = this.componentMethodsProxy('animate');
|
|
560
|
-
this.clearAnimation = this.componentMethodsProxy('clearAnimation');
|
|
561
|
-
this.setUpdatePerformanceListener = this.componentMethodsProxy('setUpdatePerformanceListener');
|
|
562
|
-
this.state = this.state || {};
|
|
563
|
-
this.init(weappConf);
|
|
564
|
-
defineGetter(this, 'data', 'state');
|
|
565
|
-
defineGetter(this, 'properties', 'props');
|
|
566
|
-
this.initComputed(weappConf);
|
|
567
|
-
}
|
|
568
|
-
initProps(props) {
|
|
569
|
-
const properties = {};
|
|
570
|
-
for (const propKey in props) {
|
|
571
|
-
if (props.hasOwnProperty(propKey)) {
|
|
572
|
-
const propValue = props[propKey];
|
|
573
|
-
// propValue 可能是 null, 构造函数, 对象
|
|
574
|
-
const observers = [propToState];
|
|
575
|
-
if (propValue === null || propValue === undefined) { // propValue为null、undefined情况
|
|
576
|
-
properties[propKey] = null;
|
|
577
|
-
}
|
|
578
|
-
else if (isFunction(propValue)) { // propValue为Function,即Array、String、Boolean等情况时
|
|
579
|
-
if (propValue.name === 'Array') {
|
|
580
|
-
properties[propKey] = [];
|
|
581
|
-
}
|
|
582
|
-
else if (propValue.name === 'String') {
|
|
583
|
-
properties[propKey] = '';
|
|
584
|
-
}
|
|
585
|
-
else if (propValue.name === 'Boolean') {
|
|
586
|
-
properties[propKey] = false;
|
|
587
|
-
}
|
|
588
|
-
else if (propValue.name === 'Number') {
|
|
589
|
-
properties[propKey] = 0;
|
|
590
|
-
}
|
|
591
|
-
else {
|
|
592
|
-
properties[propKey] = null;
|
|
593
|
-
}
|
|
594
|
-
}
|
|
595
|
-
else if (typeof propValue === 'object') { // propValue为对象时
|
|
596
|
-
properties[propKey] = propValue.value;
|
|
597
|
-
if (propValue.observer) {
|
|
598
|
-
observers.push(propValue.observer);
|
|
599
|
-
}
|
|
600
|
-
}
|
|
601
|
-
else {
|
|
602
|
-
properties[propKey] = null;
|
|
603
|
-
}
|
|
604
|
-
this._observeProps.push({
|
|
605
|
-
name: propKey,
|
|
606
|
-
observers: observers
|
|
607
|
-
});
|
|
608
|
-
}
|
|
631
|
+
break;
|
|
609
632
|
}
|
|
610
|
-
|
|
633
|
+
};
|
|
634
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
635
|
+
_loop();
|
|
636
|
+
}
|
|
637
|
+
} catch (err) {
|
|
638
|
+
_iterator.e(err);
|
|
639
|
+
} finally {
|
|
640
|
+
_iterator.f();
|
|
611
641
|
}
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
case 'created':
|
|
619
|
-
case 'attached':
|
|
620
|
-
case 'detached':
|
|
621
|
-
case 'ready':
|
|
622
|
-
list.forEach(fn => this.initLifeCycles(key, fn));
|
|
623
|
-
break;
|
|
624
|
-
}
|
|
625
|
-
}
|
|
626
|
-
}
|
|
627
|
-
for (const confKey in options) {
|
|
628
|
-
// 不支持的属性
|
|
629
|
-
if (nonsupport.has(confKey)) {
|
|
630
|
-
const advise = nonsupport.get(confKey);
|
|
631
|
-
report(advise);
|
|
632
|
-
}
|
|
633
|
-
const confValue = options[confKey];
|
|
634
|
-
switch (confKey) {
|
|
635
|
-
case 'behaviors':
|
|
636
|
-
break;
|
|
637
|
-
case 'data': {
|
|
638
|
-
if (isApp) {
|
|
639
|
-
this[confKey] = confValue;
|
|
640
|
-
if (!appOptions.includes(confKey)) {
|
|
641
|
-
this.defineProperty(this.taroGlobalData, confKey, this);
|
|
642
|
-
}
|
|
643
|
-
}
|
|
644
|
-
else {
|
|
645
|
-
this.state = Object.assign(Object.assign({}, confValue), this.state);
|
|
646
|
-
}
|
|
647
|
-
break;
|
|
648
|
-
}
|
|
649
|
-
case 'properties':
|
|
650
|
-
this.initProps(Object.assign(behaviorProperties, confValue));
|
|
651
|
-
break;
|
|
652
|
-
case 'methods':
|
|
653
|
-
this.methods = confValue;
|
|
654
|
-
for (const key in confValue) {
|
|
655
|
-
const method = confValue[key];
|
|
656
|
-
this[key] = bind(method, this);
|
|
657
|
-
}
|
|
658
|
-
break;
|
|
659
|
-
case 'lifetimes':
|
|
660
|
-
for (const key in confValue) {
|
|
661
|
-
this.initLifeCycles(key, confValue[key]);
|
|
662
|
-
}
|
|
663
|
-
break;
|
|
664
|
-
case 'pageLifetimes':
|
|
665
|
-
for (const key in confValue) {
|
|
666
|
-
const cb = confValue[key];
|
|
667
|
-
switch (key) {
|
|
668
|
-
case 'show': {
|
|
669
|
-
this.initLifeCycleListener('show', cb);
|
|
670
|
-
break;
|
|
671
|
-
}
|
|
672
|
-
case 'hide': {
|
|
673
|
-
this.initLifeCycleListener('hide', cb);
|
|
674
|
-
break;
|
|
675
|
-
}
|
|
676
|
-
case 'resize': {
|
|
677
|
-
report('不支持组件所在页面的生命周期 pageLifetimes.resize。');
|
|
678
|
-
break;
|
|
679
|
-
}
|
|
680
|
-
}
|
|
681
|
-
}
|
|
682
|
-
break;
|
|
683
|
-
default:
|
|
684
|
-
if (lifecycles.has(confKey)) {
|
|
685
|
-
// 优先使用 lifetimes 中定义的生命周期
|
|
686
|
-
if ((_b = options.lifetimes) === null || _b === void 0 ? void 0 : _b[confKey]) {
|
|
687
|
-
break;
|
|
688
|
-
}
|
|
689
|
-
const lifecycle = options[confKey];
|
|
690
|
-
this.initLifeCycles(confKey, lifecycle);
|
|
691
|
-
}
|
|
692
|
-
else if (isFunction(confValue)) {
|
|
693
|
-
this[confKey] = bind(confValue, this);
|
|
694
|
-
if (isApp && !appOptions.includes(confKey)) {
|
|
695
|
-
this.defineProperty(this.taroGlobalData, confKey, this);
|
|
696
|
-
}
|
|
697
|
-
// 原生页面和 Taro 页面中共计只能定义一次的生命周期
|
|
698
|
-
if (uniquePageLifecycle.includes(confKey) && ConnectComponent.prototype[confKey]) {
|
|
699
|
-
report(`生命周期 ${confKey} 已在原生部分进行定义,React 部分的定义将不会被执行。`);
|
|
700
|
-
}
|
|
701
|
-
}
|
|
702
|
-
else {
|
|
703
|
-
this[confKey] = confValue;
|
|
704
|
-
if (isApp && !appOptions.includes(confKey)) {
|
|
705
|
-
this.defineProperty(this.taroGlobalData, confKey, this);
|
|
706
|
-
}
|
|
707
|
-
}
|
|
708
|
-
break;
|
|
709
|
-
}
|
|
710
|
-
}
|
|
711
|
-
// 处理 Behaviors
|
|
712
|
-
if ((_c = options.behaviors) === null || _c === void 0 ? void 0 : _c.length) {
|
|
713
|
-
const behaviorData = {};
|
|
714
|
-
const methods = {};
|
|
715
|
-
for (const [key, list] of behaviorMap.entries()) {
|
|
716
|
-
switch (key) {
|
|
717
|
-
case 'data':
|
|
718
|
-
[...list, this.state].forEach((dataObject, index) => {
|
|
719
|
-
Object.keys(dataObject).forEach(dataKey => {
|
|
720
|
-
const value = dataObject[dataKey];
|
|
721
|
-
const preValue = behaviorData[dataKey];
|
|
722
|
-
const valueType = typeof value;
|
|
723
|
-
const preValueType = typeof preValue;
|
|
724
|
-
if (valueType === 'object') {
|
|
725
|
-
if (!value) {
|
|
726
|
-
behaviorData[dataKey] = value;
|
|
727
|
-
}
|
|
728
|
-
else if (preValueType !== 'object' || !preValueType || Array.isArray(value)) {
|
|
729
|
-
behaviorData[dataKey] = index === list.length ? value : clone(value);
|
|
730
|
-
}
|
|
731
|
-
else {
|
|
732
|
-
const newVal = Object.assign({}, preValue, value);
|
|
733
|
-
behaviorData[dataKey] = index === list.length ? newVal : clone(newVal);
|
|
734
|
-
}
|
|
735
|
-
}
|
|
736
|
-
else {
|
|
737
|
-
behaviorData[dataKey] = value;
|
|
738
|
-
}
|
|
739
|
-
});
|
|
740
|
-
});
|
|
741
|
-
this.state = behaviorData;
|
|
742
|
-
break;
|
|
743
|
-
case 'methods':
|
|
744
|
-
list.forEach(methodsObject => {
|
|
745
|
-
Object.assign(methods, methodsObject);
|
|
746
|
-
});
|
|
747
|
-
Object.keys(methods).forEach(methodName => {
|
|
748
|
-
if (!this[methodName]) {
|
|
749
|
-
const method = methods[methodName];
|
|
750
|
-
this[methodName] = bind(method, this);
|
|
751
|
-
}
|
|
752
|
-
});
|
|
753
|
-
break;
|
|
754
|
-
case 'lifetimes':
|
|
755
|
-
list.forEach(lifetimesObject => {
|
|
756
|
-
for (const key in lifetimesObject) {
|
|
757
|
-
this.initLifeCycles(key, lifetimesObject[key]);
|
|
758
|
-
}
|
|
759
|
-
});
|
|
760
|
-
break;
|
|
761
|
-
}
|
|
762
|
-
}
|
|
763
|
-
}
|
|
642
|
+
}
|
|
643
|
+
for (var confKey in options) {
|
|
644
|
+
// 不支持的属性
|
|
645
|
+
if (nonsupport.has(confKey)) {
|
|
646
|
+
var advise = nonsupport.get(confKey);
|
|
647
|
+
report(advise);
|
|
764
648
|
}
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
return getter.call(Object.assign(Object.assign({}, this.state), this.methods));
|
|
776
|
-
},
|
|
777
|
-
enumerable: true, // 这将确保属性是可枚举的,如果你希望它出现在 for...in 循环中
|
|
778
|
-
configurable: true // 这将确保属性是可配置的,比如可以被删除
|
|
779
|
-
});
|
|
780
|
-
}
|
|
781
|
-
else {
|
|
782
|
-
report('computed 属性值必须是函数。');
|
|
783
|
-
}
|
|
649
|
+
var confValue = options[confKey];
|
|
650
|
+
switch (confKey) {
|
|
651
|
+
case 'behaviors':
|
|
652
|
+
break;
|
|
653
|
+
case 'data':
|
|
654
|
+
{
|
|
655
|
+
if (isApp) {
|
|
656
|
+
this[confKey] = confValue;
|
|
657
|
+
if (!appOptions.includes(confKey)) {
|
|
658
|
+
this.defineProperty(this.taroGlobalData, confKey, this);
|
|
784
659
|
}
|
|
660
|
+
} else {
|
|
661
|
+
this.state = Object.assign(Object.assign({}, confValue), this.state);
|
|
662
|
+
}
|
|
663
|
+
break;
|
|
785
664
|
}
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
if (lifecycleName === 'ready') {
|
|
794
|
-
// 如果组件是延时渲染的,页面 onReady 的事件已经 emit 了,因此使用 componentDidMount + nextTick 模拟
|
|
795
|
-
if (this.current.page.onReady.called) {
|
|
796
|
-
this.didMounts.push(function (...args) {
|
|
797
|
-
taro.nextTick(() => {
|
|
798
|
-
if (isFunction(lifecycle)) {
|
|
799
|
-
lifecycle.apply(this, args);
|
|
800
|
-
}
|
|
801
|
-
});
|
|
802
|
-
});
|
|
803
|
-
}
|
|
804
|
-
else {
|
|
805
|
-
this.initLifeCycleListener('ready', lifecycle);
|
|
806
|
-
}
|
|
665
|
+
case 'properties':
|
|
666
|
+
this.initProps(Object.assign(behaviorProperties, confValue));
|
|
667
|
+
break;
|
|
668
|
+
case 'methods':
|
|
669
|
+
for (var key in confValue) {
|
|
670
|
+
var method = confValue[key];
|
|
671
|
+
this[key] = bind(method, this);
|
|
807
672
|
}
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
switch (lifecycleKey) {
|
|
813
|
-
case TaroLifeCycles.DidHide:
|
|
814
|
-
this.didHides.push(lifecycle);
|
|
815
|
-
break;
|
|
816
|
-
case TaroLifeCycles.DidMount:
|
|
817
|
-
this.didMounts.push(lifecycle);
|
|
818
|
-
break;
|
|
819
|
-
case TaroLifeCycles.DidShow:
|
|
820
|
-
this.didShows.push(lifecycle);
|
|
821
|
-
break;
|
|
822
|
-
case TaroLifeCycles.WillMount:
|
|
823
|
-
this.willMounts.push(lifecycle);
|
|
824
|
-
break;
|
|
825
|
-
case TaroLifeCycles.WillUnmount:
|
|
826
|
-
this.willUnmounts.push(lifecycle);
|
|
827
|
-
break;
|
|
828
|
-
}
|
|
829
|
-
}
|
|
830
|
-
}
|
|
673
|
+
break;
|
|
674
|
+
case 'lifetimes':
|
|
675
|
+
for (var _key2 in confValue) {
|
|
676
|
+
this.initLifeCycles(_key2, confValue[_key2]);
|
|
831
677
|
}
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
678
|
+
break;
|
|
679
|
+
case 'pageLifetimes':
|
|
680
|
+
for (var _key3 in confValue) {
|
|
681
|
+
var cb = confValue[_key3];
|
|
682
|
+
switch (_key3) {
|
|
683
|
+
case 'show':
|
|
684
|
+
{
|
|
685
|
+
this.initLifeCycleListener('show', cb);
|
|
686
|
+
break;
|
|
687
|
+
}
|
|
688
|
+
case 'hide':
|
|
689
|
+
{
|
|
690
|
+
this.initLifeCycleListener('hide', cb);
|
|
691
|
+
break;
|
|
692
|
+
}
|
|
693
|
+
case 'resize':
|
|
694
|
+
{
|
|
695
|
+
report('不支持组件所在页面的生命周期 pageLifetimes.resize。');
|
|
696
|
+
break;
|
|
697
|
+
}
|
|
698
|
+
}
|
|
835
699
|
}
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
700
|
+
break;
|
|
701
|
+
default:
|
|
702
|
+
if (lifecycles.has(confKey)) {
|
|
703
|
+
// 优先使用 lifetimes 中定义的生命周期
|
|
704
|
+
if ((_b = options.lifetimes) === null || _b === void 0 ? void 0 : _b[confKey]) {
|
|
705
|
+
break;
|
|
706
|
+
}
|
|
707
|
+
var lifecycle = options[confKey];
|
|
708
|
+
this.initLifeCycles(confKey, lifecycle);
|
|
709
|
+
} else if (isFunction(confValue)) {
|
|
710
|
+
this[confKey] = bind(confValue, this);
|
|
711
|
+
if (isApp && !appOptions.includes(confKey)) {
|
|
712
|
+
this.defineProperty(this.taroGlobalData, confKey, this);
|
|
713
|
+
}
|
|
714
|
+
// 原生页面和 Taro 页面中共计只能定义一次的生命周期
|
|
715
|
+
if (uniquePageLifecycle.includes(confKey) && ConnectComponent.prototype[confKey]) {
|
|
716
|
+
report("\u751F\u547D\u5468\u671F ".concat(confKey, " \u5DF2\u5728\u539F\u751F\u90E8\u5206\u8FDB\u884C\u5B9A\u4E49\uFF0CReact \u90E8\u5206\u7684\u5B9A\u4E49\u5C06\u4E0D\u4F1A\u88AB\u6267\u884C\u3002"));
|
|
717
|
+
}
|
|
718
|
+
} else {
|
|
719
|
+
this[confKey] = confValue;
|
|
720
|
+
if (isApp && !appOptions.includes(confKey)) {
|
|
721
|
+
this.defineProperty(this.taroGlobalData, confKey, this);
|
|
722
|
+
}
|
|
850
723
|
}
|
|
724
|
+
break;
|
|
851
725
|
}
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
return;
|
|
884
|
-
}
|
|
885
|
-
for (const observerKey in observers) {
|
|
886
|
-
if (/\*\*/.test(observerKey)) {
|
|
887
|
-
report('数据监听器 observers 不支持使用通配符 **。');
|
|
888
|
-
continue;
|
|
889
|
-
}
|
|
890
|
-
const keys = observerKey.split(',').map(k => k.trim());
|
|
891
|
-
let isModified = false;
|
|
892
|
-
for (let i = 0; i < keys.length; i++) {
|
|
893
|
-
const key = keys[i];
|
|
894
|
-
for (let j = 0; j < resultKeys.length; j++) {
|
|
895
|
-
const resultKey = resultKeys[j];
|
|
896
|
-
if (resultKey.startsWith(key) ||
|
|
897
|
-
(key.startsWith(resultKey) && key.endsWith(']'))) {
|
|
898
|
-
isModified = true;
|
|
899
|
-
}
|
|
726
|
+
}
|
|
727
|
+
// 处理 Behaviors
|
|
728
|
+
if ((_c = options.behaviors) === null || _c === void 0 ? void 0 : _c.length) {
|
|
729
|
+
var behaviorData = {};
|
|
730
|
+
var methods = {};
|
|
731
|
+
var _iterator2 = _createForOfIteratorHelper(behaviorMap.entries()),
|
|
732
|
+
_step2;
|
|
733
|
+
try {
|
|
734
|
+
var _loop2 = function _loop2() {
|
|
735
|
+
var _step2$value = _slicedToArray__default["default"](_step2.value, 2),
|
|
736
|
+
key = _step2$value[0],
|
|
737
|
+
list = _step2$value[1];
|
|
738
|
+
switch (key) {
|
|
739
|
+
case 'data':
|
|
740
|
+
[].concat(_toConsumableArray__default["default"](list), [_this2.state]).forEach(function (dataObject, index) {
|
|
741
|
+
Object.keys(dataObject).forEach(function (dataKey) {
|
|
742
|
+
var value = dataObject[dataKey];
|
|
743
|
+
var preValue = behaviorData[dataKey];
|
|
744
|
+
var valueType = _typeof__default["default"](value);
|
|
745
|
+
var preValueType = _typeof__default["default"](preValue);
|
|
746
|
+
if (valueType === 'object') {
|
|
747
|
+
if (!value) {
|
|
748
|
+
behaviorData[dataKey] = value;
|
|
749
|
+
} else if (preValueType !== 'object' || !preValueType || Array.isArray(value)) {
|
|
750
|
+
behaviorData[dataKey] = index === list.length ? value : clone(value);
|
|
751
|
+
} else {
|
|
752
|
+
var newVal = Object.assign({}, preValue, value);
|
|
753
|
+
behaviorData[dataKey] = index === list.length ? newVal : clone(newVal);
|
|
754
|
+
}
|
|
755
|
+
} else {
|
|
756
|
+
behaviorData[dataKey] = value;
|
|
900
757
|
}
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
758
|
+
});
|
|
759
|
+
});
|
|
760
|
+
_this2.state = behaviorData;
|
|
761
|
+
break;
|
|
762
|
+
case 'methods':
|
|
763
|
+
list.forEach(function (methodsObject) {
|
|
764
|
+
Object.assign(methods, methodsObject);
|
|
765
|
+
});
|
|
766
|
+
Object.keys(methods).forEach(function (methodName) {
|
|
767
|
+
if (!_this2[methodName]) {
|
|
768
|
+
var _method = methods[methodName];
|
|
769
|
+
_this2[methodName] = bind(_method, _this2);
|
|
770
|
+
}
|
|
771
|
+
});
|
|
772
|
+
break;
|
|
773
|
+
case 'lifetimes':
|
|
774
|
+
list.forEach(function (lifetimesObject) {
|
|
775
|
+
for (var _key4 in lifetimesObject) {
|
|
776
|
+
_this2.initLifeCycles(_key4, lifetimesObject[_key4]);
|
|
777
|
+
}
|
|
778
|
+
});
|
|
779
|
+
break;
|
|
780
|
+
default:
|
|
781
|
+
break;
|
|
905
782
|
}
|
|
783
|
+
};
|
|
784
|
+
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
|
|
785
|
+
_loop2();
|
|
786
|
+
}
|
|
787
|
+
} catch (err) {
|
|
788
|
+
_iterator2.e(err);
|
|
789
|
+
} finally {
|
|
790
|
+
_iterator2.f();
|
|
906
791
|
}
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
792
|
+
}
|
|
793
|
+
}
|
|
794
|
+
}, {
|
|
795
|
+
key: "initLifeCycles",
|
|
796
|
+
value: function initLifeCycles(lifecycleName, lifecycle) {
|
|
797
|
+
// 不支持的生命周期
|
|
798
|
+
if (nonsupport.has(lifecycleName)) {
|
|
799
|
+
var advise = nonsupport.get(lifecycleName);
|
|
800
|
+
return report(advise);
|
|
801
|
+
}
|
|
802
|
+
if (lifecycleName === 'ready') {
|
|
803
|
+
// 如果组件是延时渲染的,页面 onReady 的事件已经 emit 了,因此使用 componentDidMount + nextTick 模拟
|
|
804
|
+
if (this.current.page.onReady.called) {
|
|
805
|
+
this.didMounts.push(function () {
|
|
806
|
+
var _this3 = this;
|
|
807
|
+
for (var _len2 = arguments.length, args = new Array(_len2), _key5 = 0; _key5 < _len2; _key5++) {
|
|
808
|
+
args[_key5] = arguments[_key5];
|
|
809
|
+
}
|
|
810
|
+
taro.nextTick(function () {
|
|
811
|
+
if (isFunction(lifecycle)) {
|
|
812
|
+
lifecycle.apply(_this3, args);
|
|
813
|
+
}
|
|
917
814
|
});
|
|
815
|
+
});
|
|
816
|
+
} else {
|
|
817
|
+
this.initLifeCycleListener('ready', lifecycle);
|
|
918
818
|
}
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
819
|
+
} else {
|
|
820
|
+
for (var lifecycleKey in lifecycleMap) {
|
|
821
|
+
var cycleNames = lifecycleMap[lifecycleKey];
|
|
822
|
+
if (cycleNames.indexOf(lifecycleName) !== -1) {
|
|
823
|
+
switch (lifecycleKey) {
|
|
824
|
+
case TaroLifeCycles.DidHide:
|
|
825
|
+
this.didHides.push(lifecycle);
|
|
826
|
+
break;
|
|
827
|
+
case TaroLifeCycles.DidMount:
|
|
828
|
+
this.didMounts.push(lifecycle);
|
|
829
|
+
break;
|
|
830
|
+
case TaroLifeCycles.DidShow:
|
|
831
|
+
this.didShows.push(lifecycle);
|
|
832
|
+
break;
|
|
833
|
+
case TaroLifeCycles.WillMount:
|
|
834
|
+
this.willMounts.push(lifecycle);
|
|
835
|
+
break;
|
|
836
|
+
case TaroLifeCycles.WillUnmount:
|
|
837
|
+
this.willUnmounts.push(lifecycle);
|
|
838
|
+
break;
|
|
931
839
|
}
|
|
932
|
-
|
|
933
|
-
isFunction(fn) && fn(e);
|
|
934
|
-
}
|
|
935
|
-
// ================ React 生命周期 ================
|
|
936
|
-
componentWillMount() {
|
|
937
|
-
this.safeExecute(super.componentWillMount);
|
|
938
|
-
this.executeLifeCycles(this.willMounts, this.current.router || {});
|
|
939
|
-
this.triggerObservers(this.data, BaseComponent.defaultProps);
|
|
940
|
-
this.triggerPropertiesObservers(BaseComponent.defaultProps, this.props);
|
|
941
|
-
}
|
|
942
|
-
componentDidMount() {
|
|
943
|
-
this.safeExecute(super.componentDidMount);
|
|
944
|
-
this.executeLifeCycles(this.didMounts);
|
|
945
|
-
}
|
|
946
|
-
componentWillUnmount() {
|
|
947
|
-
this.eventDestroyList.forEach(fn => fn());
|
|
948
|
-
this.safeExecute(super.componentWillUnmount);
|
|
949
|
-
this.executeLifeCycles(this.willUnmounts);
|
|
840
|
+
}
|
|
950
841
|
}
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
842
|
+
}
|
|
843
|
+
// mixins 不会覆盖已经设置的生命周期,加入到 this 是为了形如 this.created() 的调用
|
|
844
|
+
if (!isFunction(this[lifecycleName])) {
|
|
845
|
+
this[lifecycleName] = lifecycle;
|
|
846
|
+
}
|
|
847
|
+
}
|
|
848
|
+
}, {
|
|
849
|
+
key: "initLifeCycleListener",
|
|
850
|
+
value: function initLifeCycleListener(name, cb) {
|
|
851
|
+
// 组件的 ready、show、hide 需要利用页面事件触发
|
|
852
|
+
var router = this.current.router;
|
|
853
|
+
var lifecycleName = "on".concat(name[0].toUpperCase()).concat(name.slice(1));
|
|
854
|
+
cb = cb.bind(this);
|
|
855
|
+
(router === null || router === void 0 ? void 0 : router[lifecycleName]) && taro.eventCenter.on(router[lifecycleName], cb);
|
|
856
|
+
// unMount 时需要取消事件监听
|
|
857
|
+
this.eventDestroyList.push(function () {
|
|
858
|
+
return taro.eventCenter.off(router[lifecycleName], cb);
|
|
859
|
+
});
|
|
860
|
+
}
|
|
861
|
+
}, {
|
|
862
|
+
key: "executeLifeCycles",
|
|
863
|
+
value: function executeLifeCycles(funcs) {
|
|
864
|
+
for (var _len3 = arguments.length, args = new Array(_len3 > 1 ? _len3 - 1 : 0), _key6 = 1; _key6 < _len3; _key6++) {
|
|
865
|
+
args[_key6 - 1] = arguments[_key6];
|
|
866
|
+
}
|
|
867
|
+
for (var i = 0; i < funcs.length; i++) {
|
|
868
|
+
var func = funcs[i];
|
|
869
|
+
this.safeExecute.apply(this, [func].concat(args));
|
|
870
|
+
}
|
|
871
|
+
}
|
|
872
|
+
}, {
|
|
873
|
+
key: "triggerPropertiesObservers",
|
|
874
|
+
value: function triggerPropertiesObservers(prevProps, nextProps) {
|
|
875
|
+
var _this4 = this;
|
|
876
|
+
this._observeProps.forEach(function (_ref) {
|
|
877
|
+
var key = _ref.name,
|
|
878
|
+
observers = _ref.observers;
|
|
879
|
+
var prop = prevProps === null || prevProps === void 0 ? void 0 : prevProps[key];
|
|
880
|
+
var nextProp = nextProps[key];
|
|
881
|
+
// 小程序是深比较不同之后才 trigger observer
|
|
882
|
+
if (!isEqual(prop, nextProp)) {
|
|
883
|
+
observers.forEach(function (observer) {
|
|
884
|
+
if (typeof observer === 'string') {
|
|
885
|
+
var ob = _this4[observer];
|
|
886
|
+
if (isFunction(ob)) {
|
|
887
|
+
ob.call(_this4, nextProp, prop, key);
|
|
888
|
+
}
|
|
889
|
+
} else if (isFunction(observer)) {
|
|
890
|
+
observer.call(_this4, nextProp, prop, key);
|
|
891
|
+
}
|
|
892
|
+
});
|
|
997
893
|
}
|
|
998
|
-
|
|
999
|
-
|
|
894
|
+
});
|
|
895
|
+
}
|
|
896
|
+
}, {
|
|
897
|
+
key: "triggerObservers",
|
|
898
|
+
value: function triggerObservers(current, prev) {
|
|
899
|
+
var observers = this.observers;
|
|
900
|
+
if (observers == null) {
|
|
901
|
+
return;
|
|
902
|
+
}
|
|
903
|
+
if (Object.keys(observers).length === 0) {
|
|
904
|
+
return;
|
|
905
|
+
}
|
|
906
|
+
var result = diff(current, prev);
|
|
907
|
+
var resultKeys = Object.keys(result);
|
|
908
|
+
if (resultKeys.length === 0) {
|
|
909
|
+
return;
|
|
910
|
+
}
|
|
911
|
+
for (var observerKey in observers) {
|
|
912
|
+
if (/\*\*/.test(observerKey)) {
|
|
913
|
+
report('数据监听器 observers 不支持使用通配符 **。');
|
|
914
|
+
continue;
|
|
1000
915
|
}
|
|
1001
|
-
|
|
1002
|
-
|
|
916
|
+
var keys = observerKey.split(',').map(function (k) {
|
|
917
|
+
return k.trim();
|
|
918
|
+
});
|
|
919
|
+
var isModified = false;
|
|
920
|
+
for (var i = 0; i < keys.length; i++) {
|
|
921
|
+
var key = keys[i];
|
|
922
|
+
for (var j = 0; j < resultKeys.length; j++) {
|
|
923
|
+
var resultKey = resultKeys[j];
|
|
924
|
+
if (resultKey.startsWith(key) || key.startsWith(resultKey) && key.endsWith(']')) {
|
|
925
|
+
isModified = true;
|
|
926
|
+
}
|
|
927
|
+
}
|
|
1003
928
|
}
|
|
1004
|
-
|
|
1005
|
-
|
|
929
|
+
if (isModified) {
|
|
930
|
+
observers[observerKey].apply(this, keys.map(function (key) {
|
|
931
|
+
return safeGet(current, key);
|
|
932
|
+
}));
|
|
1006
933
|
}
|
|
934
|
+
}
|
|
1007
935
|
}
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
936
|
+
}, {
|
|
937
|
+
key: "defineProperty",
|
|
938
|
+
value: function defineProperty(target, key, data) {
|
|
939
|
+
Object.defineProperty(target, key, {
|
|
940
|
+
configurable: true,
|
|
941
|
+
enumerable: true,
|
|
942
|
+
set: function set(value) {
|
|
943
|
+
data[key] = value;
|
|
944
|
+
},
|
|
945
|
+
get: function get() {
|
|
946
|
+
return data[key];
|
|
1017
947
|
}
|
|
948
|
+
});
|
|
949
|
+
}
|
|
950
|
+
}, {
|
|
951
|
+
key: "privateStopNoop",
|
|
952
|
+
value: function privateStopNoop() {
|
|
953
|
+
var e;
|
|
954
|
+
var fn;
|
|
955
|
+
if (arguments.length === 2) {
|
|
956
|
+
fn = arguments.length <= 0 ? undefined : arguments[0];
|
|
957
|
+
e = arguments.length <= 1 ? undefined : arguments[1];
|
|
958
|
+
} else if (arguments.length === 1) {
|
|
959
|
+
e = arguments.length <= 0 ? undefined : arguments[0];
|
|
960
|
+
}
|
|
961
|
+
if (e.type === 'touchmove') {
|
|
962
|
+
report('catchtouchmove 转换后只能停止回调函数的冒泡,不能阻止滚动穿透。如要阻止滚动穿透,可以手动给编译后的 View 组件加上 catchMove 属性');
|
|
963
|
+
}
|
|
964
|
+
e.stopPropagation();
|
|
965
|
+
isFunction(fn) && fn(e);
|
|
966
|
+
}
|
|
967
|
+
// ================ React 生命周期 ================
|
|
968
|
+
}, {
|
|
969
|
+
key: "componentWillMount",
|
|
970
|
+
value: function componentWillMount() {
|
|
971
|
+
this.safeExecute(_get__default["default"](_getPrototypeOf__default["default"](BaseComponent.prototype), "componentWillMount", this));
|
|
972
|
+
this.executeLifeCycles(this.willMounts, this.current.router || {});
|
|
973
|
+
this.triggerObservers(this.data, BaseComponent.defaultProps);
|
|
974
|
+
this.triggerPropertiesObservers(BaseComponent.defaultProps, this.props);
|
|
975
|
+
}
|
|
976
|
+
}, {
|
|
977
|
+
key: "componentDidMount",
|
|
978
|
+
value: function componentDidMount() {
|
|
979
|
+
this.safeExecute(_get__default["default"](_getPrototypeOf__default["default"](BaseComponent.prototype), "componentDidMount", this));
|
|
980
|
+
this.executeLifeCycles(this.didMounts);
|
|
981
|
+
}
|
|
982
|
+
}, {
|
|
983
|
+
key: "componentWillUnmount",
|
|
984
|
+
value: function componentWillUnmount() {
|
|
985
|
+
this.eventDestroyList.forEach(function (fn) {
|
|
986
|
+
return fn();
|
|
987
|
+
});
|
|
988
|
+
this.safeExecute(_get__default["default"](_getPrototypeOf__default["default"](BaseComponent.prototype), "componentWillUnmount", this));
|
|
989
|
+
this.executeLifeCycles(this.willUnmounts);
|
|
1018
990
|
}
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
991
|
+
}, {
|
|
992
|
+
key: "componentDidHide",
|
|
993
|
+
value: function componentDidHide() {
|
|
994
|
+
this.safeExecute(_get__default["default"](_getPrototypeOf__default["default"](BaseComponent.prototype), "componentDidHide", this));
|
|
995
|
+
this.executeLifeCycles(this.didHides);
|
|
996
|
+
}
|
|
997
|
+
}, {
|
|
998
|
+
key: "componentDidShow",
|
|
999
|
+
value: function componentDidShow() {
|
|
1000
|
+
this.safeExecute(_get__default["default"](_getPrototypeOf__default["default"](BaseComponent.prototype), "componentDidShow", this), this.current.router || {});
|
|
1001
|
+
this.executeLifeCycles(this.didShows, this.current.router || {});
|
|
1002
|
+
}
|
|
1003
|
+
}, {
|
|
1004
|
+
key: "componentWillReceiveProps",
|
|
1005
|
+
value: function componentWillReceiveProps(nextProps) {
|
|
1006
|
+
this.triggerObservers(nextProps, this.props);
|
|
1007
|
+
this.triggerPropertiesObservers(this.props, nextProps);
|
|
1008
|
+
this.safeExecute(_get__default["default"](_getPrototypeOf__default["default"](BaseComponent.prototype), "componentWillReceiveProps", this));
|
|
1009
|
+
}
|
|
1010
|
+
// ================ 小程序 App, Page, Component 实例属性与方法 ================
|
|
1011
|
+
}, {
|
|
1012
|
+
key: "is",
|
|
1013
|
+
get: function get() {
|
|
1014
|
+
return this.current.page.is;
|
|
1015
|
+
}
|
|
1016
|
+
}, {
|
|
1017
|
+
key: "id",
|
|
1018
|
+
get: function get() {
|
|
1019
|
+
return this.current.page.id;
|
|
1020
|
+
}
|
|
1021
|
+
}, {
|
|
1022
|
+
key: "dataset",
|
|
1023
|
+
get: function get() {
|
|
1024
|
+
return this.current.page.dataset;
|
|
1025
|
+
}
|
|
1026
|
+
}, {
|
|
1027
|
+
key: "componentMethodsProxy",
|
|
1028
|
+
value: function componentMethodsProxy(method) {
|
|
1029
|
+
var _this5 = this;
|
|
1030
|
+
return function () {
|
|
1031
|
+
var page = _this5.current.page;
|
|
1032
|
+
if (page === null || page === void 0 ? void 0 : page[method]) {
|
|
1033
|
+
return page[method].apply(page, arguments);
|
|
1034
|
+
} else if (method === 'createSelectorQuery') {
|
|
1035
|
+
return taro.createSelectorQuery();
|
|
1036
|
+
} else if (method === 'createIntersectionObserver') {
|
|
1037
|
+
// @ts-ignore
|
|
1038
|
+
return taro.createIntersectionObserver.apply(void 0, arguments);
|
|
1039
|
+
} else if (method === 'createMediaQueryObserver') {
|
|
1040
|
+
return taro.createMediaQueryObserver();
|
|
1041
|
+
} else {
|
|
1042
|
+
console.error("page \u4E0B\u6CA1\u6709 ".concat(method, " \u65B9\u6CD5"));
|
|
1024
1043
|
}
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1044
|
+
};
|
|
1045
|
+
}
|
|
1046
|
+
}, {
|
|
1047
|
+
key: "selectComponent",
|
|
1048
|
+
value: function selectComponent() {
|
|
1049
|
+
report(nonsupport.get('selectComponent'));
|
|
1050
|
+
}
|
|
1051
|
+
}, {
|
|
1052
|
+
key: "selectAllComponents",
|
|
1053
|
+
value: function selectAllComponents() {
|
|
1054
|
+
report(nonsupport.get('selectAllComponents'));
|
|
1055
|
+
}
|
|
1056
|
+
}, {
|
|
1057
|
+
key: "selectOwnerComponent",
|
|
1058
|
+
value: function selectOwnerComponent() {
|
|
1059
|
+
report(nonsupport.get('selectOwnerComponent'));
|
|
1060
|
+
}
|
|
1061
|
+
}, {
|
|
1062
|
+
key: "groupSetData",
|
|
1063
|
+
value: function groupSetData() {
|
|
1064
|
+
report(nonsupport.get('groupSetData'));
|
|
1065
|
+
}
|
|
1066
|
+
}]);
|
|
1067
|
+
return BaseComponent;
|
|
1068
|
+
}(ConnectComponent);
|
|
1069
|
+
var props = weappConf.properties;
|
|
1070
|
+
if (props) {
|
|
1071
|
+
for (var propKey in props) {
|
|
1072
|
+
var propValue = props[propKey];
|
|
1073
|
+
if (propValue != null && !isFunction(propValue)) {
|
|
1074
|
+
if (propValue.value !== undefined) {
|
|
1075
|
+
// 如果是 null 也赋值到 defaultProps
|
|
1076
|
+
BaseComponent.defaultProps = Object.assign(_defineProperty__default["default"]({}, propKey, propValue.value), BaseComponent.defaultProps);
|
|
1077
|
+
}
|
|
1078
|
+
}
|
|
1079
|
+
}
|
|
1080
|
+
}
|
|
1081
|
+
var staticOptions = ['externalClasses', 'relations', 'options'];
|
|
1082
|
+
staticOptions.forEach(function (option) {
|
|
1083
|
+
var value = weappConf[option];
|
|
1084
|
+
if (value != null) {
|
|
1085
|
+
BaseComponent[option] = value;
|
|
1086
|
+
}
|
|
1087
|
+
});
|
|
1088
|
+
return BaseComponent;
|
|
1089
|
+
};
|
|
1028
1090
|
}
|
|
1029
1091
|
|
|
1030
1092
|
exports.cacheOptions = cacheOptions;
|
|
1031
1093
|
exports.convertToArray = convertToArray;
|
|
1032
|
-
exports
|
|
1094
|
+
exports["default"] = withWeapp;
|
|
1033
1095
|
exports.getTarget = getTarget;
|
|
1034
1096
|
//# sourceMappingURL=index.js.map
|