@tarojs/api 4.0.0-canary.0 → 4.0.0-canary.10
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 +14 -0
- package/dist/env.d.ts +15 -0
- package/dist/env.js +53 -0
- package/dist/index.cjs.d.ts +2 -0
- package/dist/index.cjs.js +243 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.esm.d.ts +2 -0
- package/dist/index.esm.js +192 -297
- package/dist/index.js +21 -352
- package/dist/interceptor/chain.d.ts +17 -0
- package/dist/interceptor/chain.js +29 -0
- package/dist/interceptor/index.d.ts +12 -0
- package/dist/interceptor/index.js +29 -0
- package/dist/interceptor/interceptors.d.ts +4 -0
- package/dist/interceptor/interceptors.js +47 -0
- package/dist/taro.d.ts +2 -0
- package/dist/taro.js +196 -306
- package/dist/tools.d.ts +5 -0
- package/dist/tools.js +66 -0
- package/package.json +19 -11
- package/dist/index.esm.js.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/taro.js.map +0 -1
package/dist/index.esm.js
CHANGED
|
@@ -1,346 +1,241 @@
|
|
|
1
|
-
import _typeof from '@babel/runtime/helpers/typeof';
|
|
2
1
|
import { Current, getCurrentInstance, options, nextTick, eventCenter, Events } from '@tarojs/runtime';
|
|
3
|
-
import {
|
|
4
|
-
import _objectSpread from '@babel/runtime/helpers/objectSpread2';
|
|
5
|
-
import _classCallCheck from '@babel/runtime/helpers/classCallCheck';
|
|
6
|
-
import _createClass from '@babel/runtime/helpers/createClass';
|
|
7
|
-
import _defineProperty from '@babel/runtime/helpers/defineProperty';
|
|
2
|
+
import { isFunction, isUndefined, isObject } from '@tarojs/shared';
|
|
8
3
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
4
|
+
const ENV_TYPE = {
|
|
5
|
+
WEAPP: 'WEAPP',
|
|
6
|
+
SWAN: 'SWAN',
|
|
7
|
+
ALIPAY: 'ALIPAY',
|
|
8
|
+
TT: 'TT',
|
|
9
|
+
QQ: 'QQ',
|
|
10
|
+
JD: 'JD',
|
|
11
|
+
WEB: 'WEB',
|
|
12
|
+
RN: 'RN',
|
|
13
|
+
HARMONY: 'HARMONY',
|
|
14
|
+
QUICKAPP: 'QUICKAPP',
|
|
15
|
+
HARMONYHYBRID: 'HARMONYHYBRID',
|
|
21
16
|
};
|
|
22
|
-
function
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
if (!isFunction(Object.assign)) {
|
|
26
|
-
// Must be writable: true, enumerable: false, configurable: true
|
|
27
|
-
Object.assign = function (target) {
|
|
28
|
-
// .length of function is 2
|
|
29
|
-
if (target == null) {
|
|
30
|
-
// TypeError if undefined or null
|
|
31
|
-
throwTypeError('Cannot convert undefined or null to object');
|
|
17
|
+
function getEnv() {
|
|
18
|
+
if (process.env.TARO_ENV === 'weapp') {
|
|
19
|
+
return ENV_TYPE.WEAPP;
|
|
32
20
|
}
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
var nextSource = arguments[index];
|
|
36
|
-
if (nextSource != null) {
|
|
37
|
-
// Skip over if undefined or null
|
|
38
|
-
for (var nextKey in nextSource) {
|
|
39
|
-
// Avoid bugs when hasOwnProperty is shadowed
|
|
40
|
-
if (Object.prototype.hasOwnProperty.call(nextSource, nextKey)) {
|
|
41
|
-
to[nextKey] = nextSource[nextKey];
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
}
|
|
21
|
+
else if (process.env.TARO_ENV === 'alipay') {
|
|
22
|
+
return ENV_TYPE.ALIPAY;
|
|
45
23
|
}
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
}
|
|
49
|
-
if (!isFunction(Object.defineProperties)) {
|
|
50
|
-
Object.defineProperties = function (obj, properties) {
|
|
51
|
-
function convertToDescriptor(desc) {
|
|
52
|
-
function hasProperty(obj, prop) {
|
|
53
|
-
return Object.prototype.hasOwnProperty.call(obj, prop);
|
|
54
|
-
}
|
|
55
|
-
if (isBadObj(desc)) {
|
|
56
|
-
throwTypeError('bad desc');
|
|
57
|
-
}
|
|
58
|
-
var d = {};
|
|
59
|
-
if (hasProperty(desc, 'enumerable')) d.enumerable = !!desc.enumerable;
|
|
60
|
-
if (hasProperty(desc, 'configurable')) {
|
|
61
|
-
d.configurable = !!desc.configurable;
|
|
62
|
-
}
|
|
63
|
-
if (hasProperty(desc, 'value')) d.value = desc.value;
|
|
64
|
-
if (hasProperty(desc, 'writable')) d.writable = !!desc.writable;
|
|
65
|
-
if (hasProperty(desc, 'get')) {
|
|
66
|
-
var g = desc.get;
|
|
67
|
-
if (!isFunction(g) && !isUndefined(g)) {
|
|
68
|
-
throwTypeError('bad get');
|
|
69
|
-
}
|
|
70
|
-
d.get = g;
|
|
71
|
-
}
|
|
72
|
-
if (hasProperty(desc, 'set')) {
|
|
73
|
-
var s = desc.set;
|
|
74
|
-
if (!isFunction(s) && !isUndefined(s)) {
|
|
75
|
-
throwTypeError('bad set');
|
|
76
|
-
}
|
|
77
|
-
d.set = s;
|
|
78
|
-
}
|
|
79
|
-
if (('get' in d || 'set' in d) && ('value' in d || 'writable' in d)) {
|
|
80
|
-
throwTypeError('identity-confused descriptor');
|
|
81
|
-
}
|
|
82
|
-
return d;
|
|
24
|
+
else if (process.env.TARO_ENV === 'swan') {
|
|
25
|
+
return ENV_TYPE.SWAN;
|
|
83
26
|
}
|
|
84
|
-
if (
|
|
85
|
-
|
|
86
|
-
var keys = Object.keys(properties);
|
|
87
|
-
var descs = [];
|
|
88
|
-
for (var i = 0; i < keys.length; i++) {
|
|
89
|
-
descs.push([keys[i], convertToDescriptor(properties[keys[i]])]);
|
|
27
|
+
else if (process.env.TARO_ENV === 'tt') {
|
|
28
|
+
return ENV_TYPE.TT;
|
|
90
29
|
}
|
|
91
|
-
|
|
92
|
-
|
|
30
|
+
else if (process.env.TARO_ENV === 'jd') {
|
|
31
|
+
return ENV_TYPE.JD;
|
|
32
|
+
}
|
|
33
|
+
else if (process.env.TARO_ENV === 'qq') {
|
|
34
|
+
return ENV_TYPE.QQ;
|
|
35
|
+
}
|
|
36
|
+
else if (process.env.TARO_ENV === 'harmony-hybrid') {
|
|
37
|
+
return ENV_TYPE.HARMONYHYBRID;
|
|
38
|
+
}
|
|
39
|
+
else if (process.env.TARO_ENV === 'h5' || process.env.TARO_PLATFORM === 'web') {
|
|
40
|
+
return ENV_TYPE.WEB;
|
|
41
|
+
}
|
|
42
|
+
else if (process.env.TARO_ENV === 'rn') {
|
|
43
|
+
return ENV_TYPE.RN;
|
|
44
|
+
}
|
|
45
|
+
else if (process.env.TARO_ENV === 'harmony' || process.env.TARO_PLATFORM === 'harmony') {
|
|
46
|
+
return ENV_TYPE.HARMONY;
|
|
47
|
+
}
|
|
48
|
+
else if (process.env.TARO_ENV === 'quickapp') {
|
|
49
|
+
return ENV_TYPE.QUICKAPP;
|
|
50
|
+
}
|
|
51
|
+
else {
|
|
52
|
+
return process.env.TARO_ENV || 'Unknown';
|
|
93
53
|
}
|
|
94
|
-
return obj;
|
|
95
|
-
};
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
var ENV_TYPE = {
|
|
99
|
-
WEAPP: 'WEAPP',
|
|
100
|
-
SWAN: 'SWAN',
|
|
101
|
-
ALIPAY: 'ALIPAY',
|
|
102
|
-
TT: 'TT',
|
|
103
|
-
QQ: 'QQ',
|
|
104
|
-
JD: 'JD',
|
|
105
|
-
WEB: 'WEB',
|
|
106
|
-
RN: 'RN',
|
|
107
|
-
HARMONY: 'HARMONY',
|
|
108
|
-
QUICKAPP: 'QUICKAPP'
|
|
109
|
-
};
|
|
110
|
-
var isWeb = isWebPlatform();
|
|
111
|
-
function getEnv() {
|
|
112
|
-
if (process.env.TARO_ENV === 'weapp') {
|
|
113
|
-
return ENV_TYPE.WEAPP;
|
|
114
|
-
} else if (process.env.TARO_ENV === 'alipay') {
|
|
115
|
-
return ENV_TYPE.ALIPAY;
|
|
116
|
-
} else if (process.env.TARO_ENV === 'swan') {
|
|
117
|
-
return ENV_TYPE.SWAN;
|
|
118
|
-
} else if (process.env.TARO_ENV === 'tt') {
|
|
119
|
-
return ENV_TYPE.TT;
|
|
120
|
-
} else if (process.env.TARO_ENV === 'jd') {
|
|
121
|
-
return ENV_TYPE.JD;
|
|
122
|
-
} else if (process.env.TARO_ENV === 'qq') {
|
|
123
|
-
return ENV_TYPE.QQ;
|
|
124
|
-
} else if (isWeb) {
|
|
125
|
-
return ENV_TYPE.WEB;
|
|
126
|
-
} else if (process.env.TARO_ENV === 'rn') {
|
|
127
|
-
return ENV_TYPE.RN;
|
|
128
|
-
} else if (process.env.TARO_ENV === 'harmony') {
|
|
129
|
-
return ENV_TYPE.HARMONY;
|
|
130
|
-
} else if (process.env.TARO_ENV === 'quickapp') {
|
|
131
|
-
return ENV_TYPE.QUICKAPP;
|
|
132
|
-
} else {
|
|
133
|
-
return process.env.TARO_ENV || 'Unknown';
|
|
134
|
-
}
|
|
135
54
|
}
|
|
136
55
|
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
var res = p.catch(function (err) {
|
|
155
|
-
return Promise.reject(err);
|
|
156
|
-
});
|
|
157
|
-
Object.keys(p).forEach(function (k) {
|
|
158
|
-
return isFunction(p[k]) && (res[k] = p[k]);
|
|
159
|
-
});
|
|
160
|
-
return res;
|
|
56
|
+
class Chain {
|
|
57
|
+
constructor(requestParams, interceptors, index) {
|
|
58
|
+
this.index = index || 0;
|
|
59
|
+
this.requestParams = requestParams || {};
|
|
60
|
+
this.interceptors = interceptors || [];
|
|
61
|
+
}
|
|
62
|
+
proceed(requestParams = {}) {
|
|
63
|
+
this.requestParams = requestParams;
|
|
64
|
+
if (this.index >= this.interceptors.length) {
|
|
65
|
+
throw new Error('chain 参数错误, 请勿直接修改 request.chain');
|
|
66
|
+
}
|
|
67
|
+
const nextInterceptor = this._getNextInterceptor();
|
|
68
|
+
const nextChain = this._getNextChain();
|
|
69
|
+
const p = nextInterceptor(nextChain);
|
|
70
|
+
const res = p.catch(err => Promise.reject(err));
|
|
71
|
+
Object.keys(p).forEach(k => isFunction(p[k]) && (res[k] = p[k]));
|
|
72
|
+
return res;
|
|
161
73
|
}
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
value: function _getNextInterceptor() {
|
|
165
|
-
return this.interceptors[this.index];
|
|
74
|
+
_getNextInterceptor() {
|
|
75
|
+
return this.interceptors[this.index];
|
|
166
76
|
}
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
value: function _getNextChain() {
|
|
170
|
-
return new Chain(this.requestParams, this.interceptors, this.index + 1);
|
|
77
|
+
_getNextChain() {
|
|
78
|
+
return new Chain(this.requestParams, this.interceptors, this.index + 1);
|
|
171
79
|
}
|
|
172
|
-
|
|
173
|
-
return Chain;
|
|
174
|
-
}();
|
|
80
|
+
}
|
|
175
81
|
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
return interceptor !== taroInterceptor;
|
|
189
|
-
}).concat(taroInterceptor);
|
|
190
|
-
return chain.proceed(_objectSpread({}, requestParams));
|
|
82
|
+
class Link {
|
|
83
|
+
constructor(interceptor) {
|
|
84
|
+
this.taroInterceptor = interceptor;
|
|
85
|
+
this.chain = new Chain();
|
|
86
|
+
}
|
|
87
|
+
request(requestParams) {
|
|
88
|
+
const chain = this.chain;
|
|
89
|
+
const taroInterceptor = this.taroInterceptor;
|
|
90
|
+
chain.interceptors = chain.interceptors
|
|
91
|
+
.filter(interceptor => interceptor !== taroInterceptor)
|
|
92
|
+
.concat(taroInterceptor);
|
|
93
|
+
return chain.proceed(Object.assign({}, requestParams));
|
|
191
94
|
}
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
value: function addInterceptor(interceptor) {
|
|
195
|
-
this.chain.interceptors.push(interceptor);
|
|
95
|
+
addInterceptor(interceptor) {
|
|
96
|
+
this.chain.interceptors.push(interceptor);
|
|
196
97
|
}
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
value: function cleanInterceptors() {
|
|
200
|
-
this.chain = new Chain();
|
|
98
|
+
cleanInterceptors() {
|
|
99
|
+
this.chain = new Chain();
|
|
201
100
|
}
|
|
202
|
-
|
|
203
|
-
return Link;
|
|
204
|
-
}();
|
|
101
|
+
}
|
|
205
102
|
function interceptorify(promiseifyApi) {
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
103
|
+
return new Link(function (chain) {
|
|
104
|
+
return promiseifyApi(chain.requestParams);
|
|
105
|
+
});
|
|
209
106
|
}
|
|
210
107
|
|
|
211
108
|
function timeoutInterceptor(chain) {
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
109
|
+
const requestParams = chain.requestParams;
|
|
110
|
+
let p;
|
|
111
|
+
const res = new Promise((resolve, reject) => {
|
|
112
|
+
const timeout = setTimeout(() => {
|
|
113
|
+
clearTimeout(timeout);
|
|
114
|
+
reject(new Error('网络链接超时,请稍后再试!'));
|
|
115
|
+
}, (requestParams && requestParams.timeout) || 60000);
|
|
116
|
+
p = chain.proceed(requestParams);
|
|
117
|
+
p
|
|
118
|
+
.then(res => {
|
|
119
|
+
if (!timeout)
|
|
120
|
+
return;
|
|
121
|
+
clearTimeout(timeout);
|
|
122
|
+
resolve(res);
|
|
123
|
+
})
|
|
124
|
+
.catch(err => {
|
|
125
|
+
timeout && clearTimeout(timeout);
|
|
126
|
+
reject(err);
|
|
127
|
+
});
|
|
227
128
|
});
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
129
|
+
// @ts-ignore
|
|
130
|
+
if (!isUndefined(p) && isFunction(p.abort))
|
|
131
|
+
res.abort = p.abort;
|
|
132
|
+
return res;
|
|
231
133
|
}
|
|
232
134
|
function logInterceptor(chain) {
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
data = requestParams.data,
|
|
236
|
-
url = requestParams.url;
|
|
237
|
-
|
|
238
|
-
// eslint-disable-next-line no-console
|
|
239
|
-
console.log("http ".concat(method || 'GET', " --> ").concat(url, " data: "), data);
|
|
240
|
-
var p = chain.proceed(requestParams);
|
|
241
|
-
var res = p.then(function (res) {
|
|
135
|
+
const requestParams = chain.requestParams;
|
|
136
|
+
const { method, data, url } = requestParams;
|
|
242
137
|
// eslint-disable-next-line no-console
|
|
243
|
-
console.log(
|
|
138
|
+
console.log(`http ${method || 'GET'} --> ${url} data: `, data);
|
|
139
|
+
const p = chain.proceed(requestParams);
|
|
140
|
+
const res = p
|
|
141
|
+
.then(res => {
|
|
142
|
+
// eslint-disable-next-line no-console
|
|
143
|
+
console.log(`http <-- ${url} result:`, res);
|
|
144
|
+
return res;
|
|
145
|
+
});
|
|
146
|
+
// @ts-ignore
|
|
147
|
+
if (isFunction(p.abort))
|
|
148
|
+
res.abort = p.abort;
|
|
244
149
|
return res;
|
|
245
|
-
});
|
|
246
|
-
if (isFunction(p.abort)) res.abort = p.abort;
|
|
247
|
-
return res;
|
|
248
150
|
}
|
|
249
151
|
|
|
250
152
|
var interceptors = /*#__PURE__*/Object.freeze({
|
|
251
153
|
__proto__: null,
|
|
252
|
-
|
|
253
|
-
|
|
154
|
+
logInterceptor: logInterceptor,
|
|
155
|
+
timeoutInterceptor: timeoutInterceptor
|
|
254
156
|
});
|
|
255
157
|
|
|
256
158
|
function Behavior(options) {
|
|
257
|
-
|
|
159
|
+
return options;
|
|
258
160
|
}
|
|
259
161
|
function getPreload(current) {
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
162
|
+
return function (key, val) {
|
|
163
|
+
current.preloadData = isObject(key)
|
|
164
|
+
? key
|
|
165
|
+
: {
|
|
166
|
+
[key]: val
|
|
167
|
+
};
|
|
168
|
+
};
|
|
263
169
|
}
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
170
|
+
const defaultDesignWidth = 750;
|
|
171
|
+
const defaultDesignRatio = {
|
|
172
|
+
640: 2.34 / 2,
|
|
173
|
+
750: 1,
|
|
174
|
+
828: 1.81 / 2
|
|
269
175
|
};
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
176
|
+
const defaultBaseFontSize = 20;
|
|
177
|
+
const defaultUnitPrecision = 5;
|
|
178
|
+
const defaultTargetUnit = 'rpx';
|
|
273
179
|
function getInitPxTransform(taro) {
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
_config$unitPrecision = config.unitPrecision,
|
|
284
|
-
unitPrecision = _config$unitPrecision === void 0 ? defaultUnitPrecision : _config$unitPrecision;
|
|
285
|
-
taro.config = taro.config || {};
|
|
286
|
-
taro.config.designWidth = designWidth;
|
|
287
|
-
taro.config.deviceRatio = deviceRatio;
|
|
288
|
-
taro.config.baseFontSize = baseFontSize;
|
|
289
|
-
taro.config.targetUnit = targetUnit;
|
|
290
|
-
taro.config.unitPrecision = unitPrecision;
|
|
291
|
-
};
|
|
180
|
+
return function (config) {
|
|
181
|
+
const { designWidth = defaultDesignWidth, deviceRatio = defaultDesignRatio, baseFontSize = defaultBaseFontSize, targetUnit = defaultTargetUnit, unitPrecision = defaultUnitPrecision, } = config;
|
|
182
|
+
taro.config = taro.config || {};
|
|
183
|
+
taro.config.designWidth = designWidth;
|
|
184
|
+
taro.config.deviceRatio = deviceRatio;
|
|
185
|
+
taro.config.baseFontSize = baseFontSize;
|
|
186
|
+
taro.config.targetUnit = targetUnit;
|
|
187
|
+
taro.config.unitPrecision = unitPrecision;
|
|
188
|
+
};
|
|
292
189
|
}
|
|
293
190
|
function getPxTransform(taro) {
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
};
|
|
191
|
+
return function (size) {
|
|
192
|
+
const config = taro.config || {};
|
|
193
|
+
const baseFontSize = config.baseFontSize;
|
|
194
|
+
const deviceRatio = config.deviceRatio || defaultDesignRatio;
|
|
195
|
+
const designWidth = (((input = 0) => isFunction(config.designWidth)
|
|
196
|
+
? config.designWidth(input)
|
|
197
|
+
: config.designWidth || defaultDesignWidth))(size);
|
|
198
|
+
if (!(designWidth in deviceRatio)) {
|
|
199
|
+
throw new Error(`deviceRatio 配置中不存在 ${designWidth} 的设置!`);
|
|
200
|
+
}
|
|
201
|
+
const targetUnit = config.targetUnit || defaultTargetUnit;
|
|
202
|
+
const unitPrecision = config.unitPrecision || defaultUnitPrecision;
|
|
203
|
+
const formatSize = ~~size;
|
|
204
|
+
let rootValue = 1 / deviceRatio[designWidth];
|
|
205
|
+
switch (targetUnit) {
|
|
206
|
+
case 'rem':
|
|
207
|
+
rootValue *= baseFontSize * 2;
|
|
208
|
+
break;
|
|
209
|
+
case 'px':
|
|
210
|
+
rootValue *= 2;
|
|
211
|
+
break;
|
|
212
|
+
}
|
|
213
|
+
let val = formatSize / rootValue;
|
|
214
|
+
if (unitPrecision >= 0 && unitPrecision <= 100) {
|
|
215
|
+
val = Number(val.toFixed(unitPrecision));
|
|
216
|
+
}
|
|
217
|
+
return val + targetUnit;
|
|
218
|
+
};
|
|
323
219
|
}
|
|
324
220
|
|
|
325
221
|
/* eslint-disable camelcase */
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
222
|
+
const Taro = {
|
|
223
|
+
Behavior,
|
|
224
|
+
getEnv,
|
|
225
|
+
ENV_TYPE,
|
|
226
|
+
Link,
|
|
227
|
+
interceptors,
|
|
228
|
+
Current,
|
|
229
|
+
getCurrentInstance,
|
|
230
|
+
options,
|
|
231
|
+
nextTick,
|
|
232
|
+
eventCenter,
|
|
233
|
+
Events,
|
|
234
|
+
getInitPxTransform,
|
|
235
|
+
interceptorify
|
|
340
236
|
};
|
|
341
237
|
Taro.initPxTransform = getInitPxTransform(Taro);
|
|
342
238
|
Taro.preload = getPreload(Current);
|
|
343
239
|
Taro.pxTransform = getPxTransform(Taro);
|
|
344
240
|
|
|
345
241
|
export { Taro as default };
|
|
346
|
-
//# sourceMappingURL=index.esm.js.map
|