@tarojs/taro-h5 3.3.10 → 3.3.14
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.cjs.js +215 -123
- package/package.json +5 -5
- package/src/api/image/chooseImage.js +2 -2
- package/src/api/image/previewImage.js +12 -3
- package/src/api/navigationBar/index.js +2 -2
- package/src/api/others/index.js +2 -2
- package/src/api/storage/index.js +4 -4
- package/src/api/tabBar/index.js +9 -9
- package/src/api/utils/index.js +2 -2
- package/src/api/video/index.js +2 -2
- package/src/api/webSocket/index.js +2 -2
- package/src/taro/index.js +1 -1
package/dist/index.cjs.js
CHANGED
|
@@ -249,7 +249,8 @@ var ENV_TYPE = {
|
|
|
249
249
|
ALIPAY: 'ALIPAY',
|
|
250
250
|
TT: 'TT',
|
|
251
251
|
QQ: 'QQ',
|
|
252
|
-
JD: 'JD'
|
|
252
|
+
JD: 'JD',
|
|
253
|
+
KWAI: 'KWAI'
|
|
253
254
|
};
|
|
254
255
|
var _env = null; // 一个taro项目肯定运行同样的环境
|
|
255
256
|
|
|
@@ -286,6 +287,11 @@ function getEnv() {
|
|
|
286
287
|
return ENV_TYPE.ALIPAY;
|
|
287
288
|
}
|
|
288
289
|
|
|
290
|
+
if (typeof ks !== 'undefined' && ks.getSystemInfo) {
|
|
291
|
+
_env = ENV_TYPE.KWAI;
|
|
292
|
+
return ENV_TYPE.KWAI;
|
|
293
|
+
}
|
|
294
|
+
|
|
289
295
|
if (typeof global !== 'undefined' && global.__fbGenNativeModule) {
|
|
290
296
|
_env = ENV_TYPE.RN;
|
|
291
297
|
return ENV_TYPE.RN;
|
|
@@ -919,7 +925,11 @@ function createBrowserHistory(b) {
|
|
|
919
925
|
|
|
920
926
|
function x(c, a) {
|
|
921
927
|
void 0 === a && (a = null);
|
|
922
|
-
return C(_extends({
|
|
928
|
+
return C(_extends({
|
|
929
|
+
pathname: q.pathname,
|
|
930
|
+
hash: "",
|
|
931
|
+
search: ""
|
|
932
|
+
}, "string" === typeof c ? J(c) : c, {
|
|
923
933
|
state: a,
|
|
924
934
|
key: H()
|
|
925
935
|
}));
|
|
@@ -1102,7 +1112,11 @@ function createHashHistory(b) {
|
|
|
1102
1112
|
|
|
1103
1113
|
function z(a, e) {
|
|
1104
1114
|
void 0 === e && (e = null);
|
|
1105
|
-
return C(_extends({
|
|
1115
|
+
return C(_extends({
|
|
1116
|
+
pathname: d.pathname,
|
|
1117
|
+
hash: "",
|
|
1118
|
+
search: ""
|
|
1119
|
+
}, "string" === typeof a ? J(a) : a, {
|
|
1106
1120
|
state: e,
|
|
1107
1121
|
key: H()
|
|
1108
1122
|
}));
|
|
@@ -1244,7 +1258,7 @@ function setHistoryMode(mode) {
|
|
|
1244
1258
|
}
|
|
1245
1259
|
}
|
|
1246
1260
|
|
|
1247
|
-
function
|
|
1261
|
+
function prependBasename() {
|
|
1248
1262
|
var url = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
|
|
1249
1263
|
return basename.replace(/\/$/, '') + '/' + url.replace(/^\//, '');
|
|
1250
1264
|
}
|
|
@@ -1286,65 +1300,98 @@ var throttle = function throttle(fn, threshold) {
|
|
|
1286
1300
|
};
|
|
1287
1301
|
};
|
|
1288
1302
|
|
|
1289
|
-
function
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
var parameters = '';
|
|
1303
|
+
var stripBasename = function stripBasename(path, basename) {
|
|
1304
|
+
return path.startsWith(basename) ? path.replace(basename, '') : path;
|
|
1305
|
+
};
|
|
1293
1306
|
|
|
1294
|
-
|
|
1295
|
-
|
|
1296
|
-
|
|
1297
|
-
|
|
1307
|
+
var isTabBar = function isTabBar(config) {
|
|
1308
|
+
var _a, _b;
|
|
1309
|
+
|
|
1310
|
+
var _config$router = config.router,
|
|
1311
|
+
_config$router$custom = _config$router.customRoutes,
|
|
1312
|
+
customRoutes = _config$router$custom === void 0 ? {} : _config$router$custom,
|
|
1313
|
+
_config$router$basena = _config$router.basename,
|
|
1314
|
+
basename = _config$router$basena === void 0 ? '' : _config$router$basena,
|
|
1315
|
+
pathname = _config$router.pathname;
|
|
1316
|
+
var routePath = stripBasename(pathname, basename);
|
|
1317
|
+
var pagePath = ((_a = Object.entries(customRoutes).find(function (_ref) {
|
|
1318
|
+
var _ref2 = _slicedToArray(_ref, 2),
|
|
1319
|
+
target = _ref2[1];
|
|
1320
|
+
|
|
1321
|
+
return target === routePath;
|
|
1322
|
+
})) === null || _a === void 0 ? void 0 : _a[0]) || routePath;
|
|
1323
|
+
return !!pagePath && (((_b = config.tabBar) === null || _b === void 0 ? void 0 : _b.list) || []).some(function (t) {
|
|
1324
|
+
return t.pagePath === pagePath;
|
|
1325
|
+
});
|
|
1326
|
+
};
|
|
1327
|
+
|
|
1328
|
+
function processNavigateUrl(option) {
|
|
1329
|
+
var pathPieces = J(option.url); // 处理自定义路由
|
|
1298
1330
|
|
|
1299
1331
|
Object.keys(routesAlias).forEach(function (key) {
|
|
1300
|
-
if (addLeadingSlash(key) === addLeadingSlash(
|
|
1301
|
-
|
|
1332
|
+
if (addLeadingSlash(key) === addLeadingSlash(pathPieces.pathname)) {
|
|
1333
|
+
pathPieces.pathname = routesAlias[key];
|
|
1302
1334
|
}
|
|
1303
|
-
});
|
|
1304
|
-
}
|
|
1335
|
+
}); // 处理 basename
|
|
1305
1336
|
|
|
1306
|
-
|
|
1307
|
-
var success = option.success,
|
|
1308
|
-
complete = option.complete,
|
|
1309
|
-
fail = option.fail;
|
|
1310
|
-
var failReason;
|
|
1337
|
+
pathPieces.pathname = prependBasename(pathPieces.pathname); // hack fix history v5 bug: https://github.com/remix-run/history/issues/814
|
|
1311
1338
|
|
|
1312
|
-
if (
|
|
1313
|
-
|
|
1314
|
-
|
|
1339
|
+
if (!pathPieces.search) pathPieces.search = '';
|
|
1340
|
+
return pathPieces;
|
|
1341
|
+
}
|
|
1315
1342
|
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
timestamp: Date.now()
|
|
1320
|
-
});
|
|
1321
|
-
} else if (method === 'redirectTo') {
|
|
1322
|
-
exports.history.replace(parsePath(option.url), {
|
|
1323
|
-
timestamp: Date.now()
|
|
1324
|
-
});
|
|
1325
|
-
} else if (method === 'navigateBack') {
|
|
1326
|
-
setHistoryBackDelta(option.delta);
|
|
1327
|
-
exports.history.go(-option.delta);
|
|
1328
|
-
}
|
|
1329
|
-
} catch (error) {
|
|
1330
|
-
failReason = error;
|
|
1331
|
-
}
|
|
1343
|
+
function navigate(_x, _x2) {
|
|
1344
|
+
return _navigate.apply(this, arguments);
|
|
1345
|
+
}
|
|
1332
1346
|
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1347
|
+
function _navigate() {
|
|
1348
|
+
_navigate = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee2(option, method) {
|
|
1349
|
+
return regeneratorRuntime.wrap(function _callee2$(_context2) {
|
|
1350
|
+
while (1) {
|
|
1351
|
+
switch (_context2.prev = _context2.next) {
|
|
1352
|
+
case 0:
|
|
1353
|
+
return _context2.abrupt("return", new Promise(function (resolve, reject) {
|
|
1354
|
+
var success = option.success,
|
|
1355
|
+
complete = option.complete,
|
|
1356
|
+
fail = option.fail;
|
|
1357
|
+
var unListen = exports.history.listen(function () {
|
|
1358
|
+
success === null || success === void 0 ? void 0 : success();
|
|
1359
|
+
complete === null || complete === void 0 ? void 0 : complete();
|
|
1360
|
+
resolve();
|
|
1361
|
+
unListen();
|
|
1362
|
+
});
|
|
1340
1363
|
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
|
|
1364
|
+
try {
|
|
1365
|
+
if ('url' in option) {
|
|
1366
|
+
var pathPieces = processNavigateUrl(option);
|
|
1367
|
+
var state = {
|
|
1368
|
+
timestamp: Date.now()
|
|
1369
|
+
};
|
|
1370
|
+
|
|
1371
|
+
if (method === 'navigateTo') {
|
|
1372
|
+
exports.history.push(pathPieces, state);
|
|
1373
|
+
} else if (method === 'redirectTo') {
|
|
1374
|
+
exports.history.replace(pathPieces, state);
|
|
1375
|
+
}
|
|
1376
|
+
} else if (method === 'navigateBack') {
|
|
1377
|
+
setHistoryBackDelta(option.delta);
|
|
1378
|
+
exports.history.go(-option.delta);
|
|
1379
|
+
}
|
|
1380
|
+
} catch (error) {
|
|
1381
|
+
fail === null || fail === void 0 ? void 0 : fail(error);
|
|
1382
|
+
complete === null || complete === void 0 ? void 0 : complete();
|
|
1383
|
+
reject(error);
|
|
1384
|
+
}
|
|
1385
|
+
}));
|
|
1386
|
+
|
|
1387
|
+
case 1:
|
|
1388
|
+
case "end":
|
|
1389
|
+
return _context2.stop();
|
|
1390
|
+
}
|
|
1391
|
+
}
|
|
1392
|
+
}, _callee2);
|
|
1393
|
+
}));
|
|
1394
|
+
return _navigate.apply(this, arguments);
|
|
1348
1395
|
}
|
|
1349
1396
|
|
|
1350
1397
|
function navigateTo(option) {
|
|
@@ -1368,10 +1415,12 @@ function navigateBack() {
|
|
|
1368
1415
|
}
|
|
1369
1416
|
|
|
1370
1417
|
function switchTab(option) {
|
|
1371
|
-
|
|
1418
|
+
// TODO: 清除掉所有的栈去目标页面
|
|
1419
|
+
return redirectTo(option);
|
|
1372
1420
|
}
|
|
1373
1421
|
|
|
1374
1422
|
function reLaunch(option) {
|
|
1423
|
+
// TODO: 清除掉所有的栈去目标页面
|
|
1375
1424
|
return redirectTo(option);
|
|
1376
1425
|
}
|
|
1377
1426
|
|
|
@@ -2043,6 +2092,10 @@ function initTabbar(config) {
|
|
|
2043
2092
|
tabbar.conf.customRoutes = {};
|
|
2044
2093
|
}
|
|
2045
2094
|
|
|
2095
|
+
if (typeof routerConfig.basename !== 'undefined') {
|
|
2096
|
+
tabbar.conf.basename = routerConfig.basename;
|
|
2097
|
+
}
|
|
2098
|
+
|
|
2046
2099
|
var container = document.getElementById('container'); // eslint-disable-next-line no-unused-expressions
|
|
2047
2100
|
|
|
2048
2101
|
container === null || container === void 0 ? void 0 : container.appendChild(tabbar);
|
|
@@ -2812,14 +2865,14 @@ function createRouter(app, config, framework) {
|
|
|
2812
2865
|
});
|
|
2813
2866
|
app.onLaunch();
|
|
2814
2867
|
var render = throttle( /*#__PURE__*/function () {
|
|
2815
|
-
var
|
|
2816
|
-
var location, action, _a, _b, _c, _d,
|
|
2868
|
+
var _ref4 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee(_ref3) {
|
|
2869
|
+
var location, action, _a, _b, _c, _d, element, pageConfig, enablePullDownRefresh, shouldLoad, delta, prevIndex, prev, pathname, _prevIndex, _prev, el, loadConfig, _pathname, routerIndex, page;
|
|
2817
2870
|
|
|
2818
2871
|
return regeneratorRuntime.wrap(function _callee$(_context) {
|
|
2819
2872
|
while (1) {
|
|
2820
2873
|
switch (_context.prev = _context.next) {
|
|
2821
2874
|
case 0:
|
|
2822
|
-
location =
|
|
2875
|
+
location = _ref3.location, action = _ref3.action;
|
|
2823
2876
|
routerConfig.router.pathname = location.pathname;
|
|
2824
2877
|
_context.prev = 2;
|
|
2825
2878
|
_context.next = 5;
|
|
@@ -2875,60 +2928,96 @@ function createRouter(app, config, framework) {
|
|
|
2875
2928
|
|
|
2876
2929
|
shouldLoad = false;
|
|
2877
2930
|
|
|
2878
|
-
if (action === 'POP') {
|
|
2879
|
-
|
|
2880
|
-
|
|
2931
|
+
if (!(action === 'POP')) {
|
|
2932
|
+
_context.next = 32;
|
|
2933
|
+
break;
|
|
2934
|
+
}
|
|
2881
2935
|
|
|
2882
|
-
|
|
2883
|
-
|
|
2884
|
-
} // 最终必须重置为 1
|
|
2936
|
+
unloadPage(runtime.Current.page);
|
|
2937
|
+
delta = historyBackDelta;
|
|
2885
2938
|
|
|
2939
|
+
while (delta-- > 1) {
|
|
2940
|
+
unloadPage(stacks.slice(-1)[0]);
|
|
2941
|
+
} // 最终必须重置为 1
|
|
2886
2942
|
|
|
2887
|
-
setHistoryBackDelta(1);
|
|
2888
|
-
prevIndex = stacks.reduceRight(function (p, s, i) {
|
|
2889
|
-
if (p !== 0) return p;else if (s.path === location.pathname + runtime.stringify(qs(i))) return i;else return 0;
|
|
2890
|
-
}, 0);
|
|
2891
|
-
prev = stacks[prevIndex];
|
|
2892
2943
|
|
|
2893
|
-
|
|
2894
|
-
|
|
2895
|
-
|
|
2896
|
-
|
|
2897
|
-
|
|
2898
|
-
|
|
2899
|
-
|
|
2900
|
-
|
|
2901
|
-
} else
|
|
2902
|
-
unloadPage(runtime.Current.page);
|
|
2944
|
+
setHistoryBackDelta(1);
|
|
2945
|
+
prevIndex = stacks.reduceRight(function (p, s, i) {
|
|
2946
|
+
if (p !== 0) return p;else if (s.path === location.pathname + runtime.stringify(qs(i))) return i;else return 0;
|
|
2947
|
+
}, 0);
|
|
2948
|
+
prev = stacks[prevIndex];
|
|
2949
|
+
|
|
2950
|
+
if (prev) {
|
|
2951
|
+
showPage(prev, pageConfig, prevIndex);
|
|
2952
|
+
} else {
|
|
2903
2953
|
shouldLoad = true;
|
|
2904
2954
|
}
|
|
2905
2955
|
|
|
2956
|
+
_context.next = 49;
|
|
2957
|
+
break;
|
|
2958
|
+
|
|
2959
|
+
case 32:
|
|
2960
|
+
if (!(action === 'PUSH')) {
|
|
2961
|
+
_context.next = 37;
|
|
2962
|
+
break;
|
|
2963
|
+
}
|
|
2964
|
+
|
|
2965
|
+
hidePage(runtime.Current.page);
|
|
2966
|
+
shouldLoad = true;
|
|
2967
|
+
_context.next = 49;
|
|
2968
|
+
break;
|
|
2969
|
+
|
|
2970
|
+
case 37:
|
|
2971
|
+
if (!(action === 'REPLACE')) {
|
|
2972
|
+
_context.next = 49;
|
|
2973
|
+
break;
|
|
2974
|
+
}
|
|
2975
|
+
|
|
2976
|
+
if (!isTabBar(config)) {
|
|
2977
|
+
_context.next = 47;
|
|
2978
|
+
break;
|
|
2979
|
+
}
|
|
2980
|
+
|
|
2981
|
+
hidePage(runtime.Current.page);
|
|
2982
|
+
pathname = stripBasename(config.router.pathname, basename);
|
|
2983
|
+
_prevIndex = stacks.findIndex(function (r) {
|
|
2984
|
+
var _a;
|
|
2985
|
+
|
|
2986
|
+
return ((_a = r.path) === null || _a === void 0 ? void 0 : _a.replace(/\?.*/g, '')) === pathname;
|
|
2987
|
+
});
|
|
2988
|
+
|
|
2989
|
+
if (!(_prevIndex > -1)) {
|
|
2990
|
+
_context.next = 45;
|
|
2991
|
+
break;
|
|
2992
|
+
}
|
|
2993
|
+
|
|
2994
|
+
// tabbar 页且之前出现过,直接复用
|
|
2995
|
+
_prev = stacks[_prevIndex];
|
|
2996
|
+
return _context.abrupt("return", showPage(_prev, pageConfig, _prevIndex));
|
|
2997
|
+
|
|
2998
|
+
case 45:
|
|
2999
|
+
_context.next = 48;
|
|
3000
|
+
break;
|
|
3001
|
+
|
|
3002
|
+
case 47:
|
|
3003
|
+
unloadPage(runtime.Current.page);
|
|
3004
|
+
|
|
3005
|
+
case 48:
|
|
3006
|
+
shouldLoad = true;
|
|
3007
|
+
|
|
3008
|
+
case 49:
|
|
2906
3009
|
if (shouldLoad) {
|
|
2907
3010
|
el = (_c = element["default"]) !== null && _c !== void 0 ? _c : element;
|
|
2908
|
-
|
|
2909
|
-
delete
|
|
2910
|
-
delete
|
|
2911
|
-
|
|
2912
|
-
|
|
2913
|
-
|
|
2914
|
-
|
|
2915
|
-
return ((_a = TabBarItem.pagePath) === null || _a === void 0 ? void 0 : _a.replace(/\?.*/g, '')) === pathname;
|
|
2916
|
-
});
|
|
2917
|
-
|
|
2918
|
-
if ((stacks === null || stacks === void 0 ? void 0 : stacks.length) > 0 && isTabBar) {
|
|
2919
|
-
routerIndex = stacks.findIndex(function (r) {
|
|
2920
|
-
var _a;
|
|
2921
|
-
|
|
2922
|
-
return ((_a = r.path) === null || _a === void 0 ? void 0 : _a.replace(/\?.*/g, '')) === pathname;
|
|
2923
|
-
});
|
|
2924
|
-
}
|
|
2925
|
-
|
|
2926
|
-
routerIndex = (routerIndex || routerIndex === 0) && routerIndex !== -1 ? routerIndex : stacks.length;
|
|
2927
|
-
page = runtime.createPageConfig(enablePullDownRefresh ? (_e = runtimeHooks.createPullDownComponent) === null || _e === void 0 ? void 0 : _e.call(runtimeHooks, el, location.pathname, framework, routerConfig.PullDownRefresh) : el, pathname + runtime.stringify(qs(routerIndex)), {}, _config);
|
|
3011
|
+
loadConfig = Object.assign({}, pageConfig);
|
|
3012
|
+
delete loadConfig['path'];
|
|
3013
|
+
delete loadConfig['load'];
|
|
3014
|
+
_pathname = stripBasename(config.router.pathname, basename);
|
|
3015
|
+
routerIndex = stacks.length;
|
|
3016
|
+
page = runtime.createPageConfig(enablePullDownRefresh ? (_d = runtimeHooks.createPullDownComponent) === null || _d === void 0 ? void 0 : _d.call(runtimeHooks, el, location.pathname, framework, routerConfig.PullDownRefresh) : el, _pathname + runtime.stringify(qs(routerIndex)), {}, loadConfig);
|
|
2928
3017
|
loadPage(page, pageConfig, routerIndex);
|
|
2929
3018
|
}
|
|
2930
3019
|
|
|
2931
|
-
case
|
|
3020
|
+
case 50:
|
|
2932
3021
|
case "end":
|
|
2933
3022
|
return _context.stop();
|
|
2934
3023
|
}
|
|
@@ -2936,13 +3025,13 @@ function createRouter(app, config, framework) {
|
|
|
2936
3025
|
}, _callee, null, [[2, 8]]);
|
|
2937
3026
|
}));
|
|
2938
3027
|
|
|
2939
|
-
return function (
|
|
2940
|
-
return
|
|
3028
|
+
return function (_x3) {
|
|
3029
|
+
return _ref4.apply(this, arguments);
|
|
2941
3030
|
};
|
|
2942
3031
|
}(), 500);
|
|
2943
3032
|
|
|
2944
3033
|
if (exports.history.location.pathname === '/') {
|
|
2945
|
-
exports.history.replace(
|
|
3034
|
+
exports.history.replace(prependBasename(routes[0].path + exports.history.location.search));
|
|
2946
3035
|
}
|
|
2947
3036
|
|
|
2948
3037
|
render({
|
|
@@ -2953,7 +3042,7 @@ function createRouter(app, config, framework) {
|
|
|
2953
3042
|
return exports.history.listen(render);
|
|
2954
3043
|
}
|
|
2955
3044
|
|
|
2956
|
-
function
|
|
3045
|
+
function shouldBeObject(target) {
|
|
2957
3046
|
if (target && _typeof$1(target) === 'object') return {
|
|
2958
3047
|
res: true
|
|
2959
3048
|
};
|
|
@@ -3291,7 +3380,7 @@ var initPxTransform = getInitPxTransform$1(taro);
|
|
|
3291
3380
|
var requirePlugin = permanentlyNotSupport('requirePlugin');
|
|
3292
3381
|
|
|
3293
3382
|
var getApp = function getApp() {
|
|
3294
|
-
return
|
|
3383
|
+
return getCurrentInstance().app;
|
|
3295
3384
|
};
|
|
3296
3385
|
|
|
3297
3386
|
var pxTransform = function pxTransform(size) {
|
|
@@ -4311,7 +4400,7 @@ var createCanvasContext = function createCanvasContext(canvasId, inst) {
|
|
|
4311
4400
|
|
|
4312
4401
|
function setStorage(options) {
|
|
4313
4402
|
// options must be an Object
|
|
4314
|
-
var isObject =
|
|
4403
|
+
var isObject = shouldBeObject(options);
|
|
4315
4404
|
|
|
4316
4405
|
if (!isObject.res) {
|
|
4317
4406
|
var _res = {
|
|
@@ -4380,7 +4469,7 @@ function setStorageSync(key) {
|
|
|
4380
4469
|
|
|
4381
4470
|
function getStorage(options) {
|
|
4382
4471
|
// options must be an Object
|
|
4383
|
-
var isObject =
|
|
4472
|
+
var isObject = shouldBeObject(options);
|
|
4384
4473
|
|
|
4385
4474
|
if (!isObject.res) {
|
|
4386
4475
|
var _res2 = {
|
|
@@ -4488,7 +4577,7 @@ function getStorageInfoSync() {
|
|
|
4488
4577
|
|
|
4489
4578
|
function removeStorage(options) {
|
|
4490
4579
|
// options must be an Object
|
|
4491
|
-
var isObject =
|
|
4580
|
+
var isObject = shouldBeObject(options);
|
|
4492
4581
|
|
|
4493
4582
|
if (!isObject.res) {
|
|
4494
4583
|
var _res3 = {
|
|
@@ -6055,7 +6144,7 @@ var uploadFile = function uploadFile(_ref2) {
|
|
|
6055
6144
|
|
|
6056
6145
|
var chooseImage = function chooseImage(options) {
|
|
6057
6146
|
// options must be an Object
|
|
6058
|
-
var isObject =
|
|
6147
|
+
var isObject = shouldBeObject(options);
|
|
6059
6148
|
|
|
6060
6149
|
if (!isObject.res) {
|
|
6061
6150
|
var _res = {
|
|
@@ -6306,11 +6395,14 @@ function _previewImage() {
|
|
|
6306
6395
|
function loadImage(url, fail) {
|
|
6307
6396
|
return new Promise(function (resolve) {
|
|
6308
6397
|
var item = document.createElement('taro-swiper-item-core');
|
|
6309
|
-
item.style.cssText = "\n display: flex;\n align-items:
|
|
6398
|
+
item.style.cssText = "\n display: flex;\n align-items: start;\n justify-content: center;\n overflow-y: scroll;\n ";
|
|
6310
6399
|
var image = new Image();
|
|
6311
6400
|
image.style.maxWidth = '100%';
|
|
6312
6401
|
image.src = url;
|
|
6313
|
-
|
|
6402
|
+
var div = document.createElement('div');
|
|
6403
|
+
div.style.cssText = "\n display: flex;\n align-items: center;\n justify-content: center;\n max-width: 100%;\n min-height: 100%;\n ";
|
|
6404
|
+
div.appendChild(image);
|
|
6405
|
+
item.appendChild(div); // Note: 等待图片加载完后返回,会导致轮播被卡住
|
|
6314
6406
|
|
|
6315
6407
|
resolve(item);
|
|
6316
6408
|
|
|
@@ -7494,7 +7586,7 @@ var openLocation = processOpenapi('openLocation', {
|
|
|
7494
7586
|
|
|
7495
7587
|
function setNavigationBarTitle(options) {
|
|
7496
7588
|
// options must be an Object
|
|
7497
|
-
var isObject =
|
|
7589
|
+
var isObject = shouldBeObject(options);
|
|
7498
7590
|
|
|
7499
7591
|
if (!isObject.res) {
|
|
7500
7592
|
var _res = {
|
|
@@ -7678,7 +7770,7 @@ function base64ToArrayBuffer(base64) {
|
|
|
7678
7770
|
}
|
|
7679
7771
|
function makePhoneCall(options) {
|
|
7680
7772
|
// options must be an Object
|
|
7681
|
-
var isObject =
|
|
7773
|
+
var isObject = shouldBeObject(options);
|
|
7682
7774
|
|
|
7683
7775
|
if (!isObject.res) {
|
|
7684
7776
|
var _res = {
|
|
@@ -10271,7 +10363,7 @@ function initTabBarApis() {
|
|
|
10271
10363
|
function setTabBarBadge() {
|
|
10272
10364
|
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
10273
10365
|
// options must be an Object
|
|
10274
|
-
var isObject =
|
|
10366
|
+
var isObject = shouldBeObject(options);
|
|
10275
10367
|
|
|
10276
10368
|
if (!isObject.res) {
|
|
10277
10369
|
var _res = {
|
|
@@ -10332,7 +10424,7 @@ function setTabBarBadge() {
|
|
|
10332
10424
|
function removeTabBarBadge() {
|
|
10333
10425
|
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
10334
10426
|
// options must be an Object
|
|
10335
|
-
var isObject =
|
|
10427
|
+
var isObject = shouldBeObject(options);
|
|
10336
10428
|
|
|
10337
10429
|
if (!isObject.res) {
|
|
10338
10430
|
var _res2 = {
|
|
@@ -10380,7 +10472,7 @@ function removeTabBarBadge() {
|
|
|
10380
10472
|
function showTabBarRedDot() {
|
|
10381
10473
|
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
10382
10474
|
// options must be an Object
|
|
10383
|
-
var isObject =
|
|
10475
|
+
var isObject = shouldBeObject(options);
|
|
10384
10476
|
|
|
10385
10477
|
if (!isObject.res) {
|
|
10386
10478
|
var _res3 = {
|
|
@@ -10428,7 +10520,7 @@ function showTabBarRedDot() {
|
|
|
10428
10520
|
function hideTabBarRedDot() {
|
|
10429
10521
|
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
10430
10522
|
// options must be an Object
|
|
10431
|
-
var isObject =
|
|
10523
|
+
var isObject = shouldBeObject(options);
|
|
10432
10524
|
|
|
10433
10525
|
if (!isObject.res) {
|
|
10434
10526
|
var _res4 = {
|
|
@@ -10476,7 +10568,7 @@ function hideTabBarRedDot() {
|
|
|
10476
10568
|
function showTabBar() {
|
|
10477
10569
|
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
10478
10570
|
// options must be an Object
|
|
10479
|
-
var isObject =
|
|
10571
|
+
var isObject = shouldBeObject(options);
|
|
10480
10572
|
|
|
10481
10573
|
if (!isObject.res) {
|
|
10482
10574
|
var _res5 = {
|
|
@@ -10524,7 +10616,7 @@ function showTabBar() {
|
|
|
10524
10616
|
function hideTabBar() {
|
|
10525
10617
|
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
10526
10618
|
// options must be an Object
|
|
10527
|
-
var isObject =
|
|
10619
|
+
var isObject = shouldBeObject(options);
|
|
10528
10620
|
|
|
10529
10621
|
if (!isObject.res) {
|
|
10530
10622
|
var _res6 = {
|
|
@@ -10575,7 +10667,7 @@ function hideTabBar() {
|
|
|
10575
10667
|
function setTabBarStyle() {
|
|
10576
10668
|
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
10577
10669
|
// options must be an Object
|
|
10578
|
-
var isObject =
|
|
10670
|
+
var isObject = shouldBeObject(options);
|
|
10579
10671
|
|
|
10580
10672
|
if (!isObject.res) {
|
|
10581
10673
|
var _res7 = {
|
|
@@ -10643,7 +10735,7 @@ function setTabBarStyle() {
|
|
|
10643
10735
|
function setTabBarItem() {
|
|
10644
10736
|
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
10645
10737
|
// options must be an Object
|
|
10646
|
-
var isObject =
|
|
10738
|
+
var isObject = shouldBeObject(options);
|
|
10647
10739
|
|
|
10648
10740
|
if (!isObject.res) {
|
|
10649
10741
|
var _res8 = {
|
|
@@ -10769,7 +10861,7 @@ var vibrateLong = function vibrateLong() {
|
|
|
10769
10861
|
|
|
10770
10862
|
function chooseVideo(options) {
|
|
10771
10863
|
// options must be an Object
|
|
10772
|
-
var isObject =
|
|
10864
|
+
var isObject = shouldBeObject(options);
|
|
10773
10865
|
|
|
10774
10866
|
if (!isObject.res) {
|
|
10775
10867
|
var _res = {
|
|
@@ -10968,7 +11060,7 @@ function connectSocket(options) {
|
|
|
10968
11060
|
var name = 'connectSocket';
|
|
10969
11061
|
return new Promise(function (resolve, reject) {
|
|
10970
11062
|
// options must be an Object
|
|
10971
|
-
var isObject =
|
|
11063
|
+
var isObject = shouldBeObject(options);
|
|
10972
11064
|
|
|
10973
11065
|
if (!isObject.res) {
|
|
10974
11066
|
var _res = {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tarojs/taro-h5",
|
|
3
|
-
"version": "3.3.
|
|
3
|
+
"version": "3.3.14",
|
|
4
4
|
"description": "Taro h5 framework",
|
|
5
5
|
"main:h5": "src/index.js",
|
|
6
6
|
"main": "dist/index.cjs.js",
|
|
@@ -33,9 +33,9 @@
|
|
|
33
33
|
"author": "O2Team",
|
|
34
34
|
"license": "MIT",
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"@tarojs/api": "3.3.
|
|
37
|
-
"@tarojs/router": "3.3.
|
|
38
|
-
"@tarojs/runtime": "3.3.
|
|
36
|
+
"@tarojs/api": "3.3.14",
|
|
37
|
+
"@tarojs/router": "3.3.14",
|
|
38
|
+
"@tarojs/runtime": "3.3.14",
|
|
39
39
|
"base64-js": "^1.3.0",
|
|
40
40
|
"jsonp-retry": "^1.0.3",
|
|
41
41
|
"mobile-detect": "^1.4.2",
|
|
@@ -45,5 +45,5 @@
|
|
|
45
45
|
"devDependencies": {
|
|
46
46
|
"jest-fetch-mock": "^3.0.3"
|
|
47
47
|
},
|
|
48
|
-
"gitHead": "
|
|
48
|
+
"gitHead": "ffd2b33c2a760094372a9ec69735ab9c4d1877e5"
|
|
49
49
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { shouldBeObject, getParameterError } from '../utils'
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* 从本地相册选择图片或使用相机拍照。
|
|
@@ -13,7 +13,7 @@ import { shouleBeObject, getParameterError } from '../utils'
|
|
|
13
13
|
*/
|
|
14
14
|
const chooseImage = function (options) {
|
|
15
15
|
// options must be an Object
|
|
16
|
-
const isObject =
|
|
16
|
+
const isObject = shouldBeObject(options)
|
|
17
17
|
if (!isObject.res) {
|
|
18
18
|
const res = { errMsg: `chooseImage${isObject.msg}` }
|
|
19
19
|
console.error(res.errMsg)
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
|
|
2
1
|
/**
|
|
3
2
|
* 在新页面中全屏预览图片。预览的过程中用户可以进行保存图片、发送给朋友等操作。
|
|
4
3
|
* @param {Object} options
|
|
@@ -67,13 +66,23 @@ function loadImage (url, fail) {
|
|
|
67
66
|
const item = document.createElement('taro-swiper-item-core')
|
|
68
67
|
item.style.cssText = `
|
|
69
68
|
display: flex;
|
|
70
|
-
align-items:
|
|
69
|
+
align-items: start;
|
|
71
70
|
justify-content: center;
|
|
71
|
+
overflow-y: scroll;
|
|
72
72
|
`
|
|
73
73
|
const image = new Image()
|
|
74
74
|
image.style.maxWidth = '100%'
|
|
75
75
|
image.src = url
|
|
76
|
-
|
|
76
|
+
const div = document.createElement('div')
|
|
77
|
+
div.style.cssText = `
|
|
78
|
+
display: flex;
|
|
79
|
+
align-items: center;
|
|
80
|
+
justify-content: center;
|
|
81
|
+
max-width: 100%;
|
|
82
|
+
min-height: 100%;
|
|
83
|
+
`
|
|
84
|
+
div.appendChild(image)
|
|
85
|
+
item.appendChild(div)
|
|
77
86
|
// Note: 等待图片加载完后返回,会导致轮播被卡住
|
|
78
87
|
resolve(item)
|
|
79
88
|
if (typeof fail === 'function') {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { shouldBeObject, getParameterError } from '../utils'
|
|
2
2
|
|
|
3
3
|
export function setNavigationBarTitle (options) {
|
|
4
4
|
// options must be an Object
|
|
5
|
-
const isObject =
|
|
5
|
+
const isObject = shouldBeObject(options)
|
|
6
6
|
if (!isObject.res) {
|
|
7
7
|
const res = { errMsg: `setNavigationBarTitle${isObject.msg}` }
|
|
8
8
|
console.error(res.errMsg)
|
package/src/api/others/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { fromByteArray, toByteArray } from 'base64-js'
|
|
2
|
-
import {
|
|
2
|
+
import { shouldBeObject, getParameterError } from '../utils'
|
|
3
3
|
|
|
4
4
|
export function arrayBufferToBase64 (arrayBuffer) {
|
|
5
5
|
return fromByteArray(arrayBuffer)
|
|
@@ -11,7 +11,7 @@ export function base64ToArrayBuffer (base64) {
|
|
|
11
11
|
|
|
12
12
|
export function makePhoneCall (options) {
|
|
13
13
|
// options must be an Object
|
|
14
|
-
const isObject =
|
|
14
|
+
const isObject = shouldBeObject(options)
|
|
15
15
|
if (!isObject.res) {
|
|
16
16
|
const res = { errMsg: `makePhoneCall${isObject.msg}` }
|
|
17
17
|
console.error(res.errMsg)
|
package/src/api/storage/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { shouldBeObject, getParameterError } from '../utils'
|
|
2
2
|
|
|
3
3
|
function setStorage (options) {
|
|
4
4
|
// options must be an Object
|
|
5
|
-
const isObject =
|
|
5
|
+
const isObject = shouldBeObject(options)
|
|
6
6
|
if (!isObject.res) {
|
|
7
7
|
const res = { errMsg: `setStorage${isObject.msg}` }
|
|
8
8
|
console.error(res.errMsg)
|
|
@@ -56,7 +56,7 @@ function setStorageSync (key, data = '') {
|
|
|
56
56
|
|
|
57
57
|
function getStorage (options) {
|
|
58
58
|
// options must be an Object
|
|
59
|
-
const isObject =
|
|
59
|
+
const isObject = shouldBeObject(options)
|
|
60
60
|
if (!isObject.res) {
|
|
61
61
|
const res = { errMsg: `getStorage${isObject.msg}` }
|
|
62
62
|
console.error(res.errMsg)
|
|
@@ -149,7 +149,7 @@ function getStorageInfoSync () {
|
|
|
149
149
|
|
|
150
150
|
function removeStorage (options) {
|
|
151
151
|
// options must be an Object
|
|
152
|
-
const isObject =
|
|
152
|
+
const isObject = shouldBeObject(options)
|
|
153
153
|
if (!isObject.res) {
|
|
154
154
|
const res = { errMsg: `removeStorage${isObject.msg}` }
|
|
155
155
|
console.error(res.errMsg)
|
package/src/api/tabBar/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import Taro from '@tarojs/api'
|
|
2
|
-
import {
|
|
2
|
+
import { shouldBeObject, getParameterError, isValidColor, successHandler, errorHandler } from '../utils'
|
|
3
3
|
|
|
4
4
|
let tabConf
|
|
5
5
|
let App
|
|
@@ -20,7 +20,7 @@ export function initTabBarApis (_App = {}) {
|
|
|
20
20
|
*/
|
|
21
21
|
export function setTabBarBadge (options = {}) {
|
|
22
22
|
// options must be an Object
|
|
23
|
-
const isObject =
|
|
23
|
+
const isObject = shouldBeObject(options)
|
|
24
24
|
if (!isObject.res) {
|
|
25
25
|
const res = { errMsg: `setTabBarBadge${isObject.msg}` }
|
|
26
26
|
console.error(res.errMsg)
|
|
@@ -78,7 +78,7 @@ export function setTabBarBadge (options = {}) {
|
|
|
78
78
|
*/
|
|
79
79
|
export function removeTabBarBadge (options = {}) {
|
|
80
80
|
// options must be an Object
|
|
81
|
-
const isObject =
|
|
81
|
+
const isObject = shouldBeObject(options)
|
|
82
82
|
if (!isObject.res) {
|
|
83
83
|
const res = { errMsg: `removeTabBarBadge${isObject.msg}` }
|
|
84
84
|
console.error(res.errMsg)
|
|
@@ -123,7 +123,7 @@ export function removeTabBarBadge (options = {}) {
|
|
|
123
123
|
*/
|
|
124
124
|
export function showTabBarRedDot (options = {}) {
|
|
125
125
|
// options must be an Object
|
|
126
|
-
const isObject =
|
|
126
|
+
const isObject = shouldBeObject(options)
|
|
127
127
|
if (!isObject.res) {
|
|
128
128
|
const res = { errMsg: `showTabBarRedDot${isObject.msg}` }
|
|
129
129
|
console.error(res.errMsg)
|
|
@@ -168,7 +168,7 @@ export function showTabBarRedDot (options = {}) {
|
|
|
168
168
|
*/
|
|
169
169
|
export function hideTabBarRedDot (options = {}) {
|
|
170
170
|
// options must be an Object
|
|
171
|
-
const isObject =
|
|
171
|
+
const isObject = shouldBeObject(options)
|
|
172
172
|
if (!isObject.res) {
|
|
173
173
|
const res = { errMsg: `hideTabBarRedDot${isObject.msg}` }
|
|
174
174
|
console.error(res.errMsg)
|
|
@@ -213,7 +213,7 @@ export function hideTabBarRedDot (options = {}) {
|
|
|
213
213
|
*/
|
|
214
214
|
export function showTabBar (options = {}) {
|
|
215
215
|
// options must be an Object
|
|
216
|
-
const isObject =
|
|
216
|
+
const isObject = shouldBeObject(options)
|
|
217
217
|
if (!isObject.res) {
|
|
218
218
|
const res = { errMsg: `showTabBar${isObject.msg}` }
|
|
219
219
|
console.error(res.errMsg)
|
|
@@ -259,7 +259,7 @@ export function showTabBar (options = {}) {
|
|
|
259
259
|
*/
|
|
260
260
|
export function hideTabBar (options = {}) {
|
|
261
261
|
// options must be an Object
|
|
262
|
-
const isObject =
|
|
262
|
+
const isObject = shouldBeObject(options)
|
|
263
263
|
if (!isObject.res) {
|
|
264
264
|
const res = { errMsg: `hideTabBar${isObject.msg}` }
|
|
265
265
|
console.error(res.errMsg)
|
|
@@ -308,7 +308,7 @@ export function hideTabBar (options = {}) {
|
|
|
308
308
|
*/
|
|
309
309
|
export function setTabBarStyle (options = {}) {
|
|
310
310
|
// options must be an Object
|
|
311
|
-
const isObject =
|
|
311
|
+
const isObject = shouldBeObject(options)
|
|
312
312
|
if (!isObject.res) {
|
|
313
313
|
const res = { errMsg: `setTabBarStyle${isObject.msg}` }
|
|
314
314
|
console.error(res.errMsg)
|
|
@@ -372,7 +372,7 @@ export function setTabBarStyle (options = {}) {
|
|
|
372
372
|
*/
|
|
373
373
|
export function setTabBarItem (options = {}) {
|
|
374
374
|
// options must be an Object
|
|
375
|
-
const isObject =
|
|
375
|
+
const isObject = shouldBeObject(options)
|
|
376
376
|
if (!isObject.res) {
|
|
377
377
|
const res = { errMsg: `setTabBarItem${isObject.msg}` }
|
|
378
378
|
console.error(res.errMsg)
|
package/src/api/utils/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/* eslint-disable prefer-promise-reject-errors */
|
|
2
2
|
import { Current, container, SERVICE_IDENTIFIER } from '@tarojs/runtime'
|
|
3
3
|
|
|
4
|
-
function
|
|
4
|
+
function shouldBeObject (target) {
|
|
5
5
|
if (target && typeof target === 'object') return { res: true }
|
|
6
6
|
return {
|
|
7
7
|
res: false,
|
|
@@ -229,7 +229,7 @@ const getTimingFunc = (easeFunc, frameCnt) => {
|
|
|
229
229
|
}
|
|
230
230
|
|
|
231
231
|
export {
|
|
232
|
-
|
|
232
|
+
shouldBeObject,
|
|
233
233
|
getParameterError,
|
|
234
234
|
inlineStyle,
|
|
235
235
|
setTransform,
|
package/src/api/video/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { shouldBeObject, getParameterError, findDOM } from '../utils'
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* @typedef {Object} ChooseVideoParam
|
|
@@ -18,7 +18,7 @@ import { shouleBeObject, getParameterError, findDOM } from '../utils'
|
|
|
18
18
|
export function chooseVideo (options) {
|
|
19
19
|
// options must be an Object
|
|
20
20
|
|
|
21
|
-
const isObject =
|
|
21
|
+
const isObject = shouldBeObject(options)
|
|
22
22
|
if (!isObject.res) {
|
|
23
23
|
const res = { errMsg: `chooseVideo${isObject.msg}` }
|
|
24
24
|
console.error(res.errMsg)
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import SocketTask from './socketTask'
|
|
2
|
-
import {
|
|
2
|
+
import { shouldBeObject, getParameterError } from '../utils'
|
|
3
3
|
|
|
4
4
|
let socketTasks = []
|
|
5
5
|
let socketsCounter = 1
|
|
@@ -9,7 +9,7 @@ function connectSocket (options) {
|
|
|
9
9
|
|
|
10
10
|
return new Promise((resolve, reject) => {
|
|
11
11
|
// options must be an Object
|
|
12
|
-
const isObject =
|
|
12
|
+
const isObject = shouldBeObject(options)
|
|
13
13
|
if (!isObject.res) {
|
|
14
14
|
const res = { errMsg: `${name}${isObject.msg}` }
|
|
15
15
|
console.error(res.errMsg)
|
package/src/taro/index.js
CHANGED