@tarojs/taro-h5 3.3.12 → 3.3.13

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 CHANGED
@@ -919,7 +919,11 @@ function createBrowserHistory(b) {
919
919
 
920
920
  function x(c, a) {
921
921
  void 0 === a && (a = null);
922
- return C(_extends({}, q, "string" === typeof c ? J(c) : c, {
922
+ return C(_extends({
923
+ pathname: q.pathname,
924
+ hash: "",
925
+ search: ""
926
+ }, "string" === typeof c ? J(c) : c, {
923
927
  state: a,
924
928
  key: H()
925
929
  }));
@@ -1102,7 +1106,11 @@ function createHashHistory(b) {
1102
1106
 
1103
1107
  function z(a, e) {
1104
1108
  void 0 === e && (e = null);
1105
- return C(_extends({}, d, "string" === typeof a ? J(a) : a, {
1109
+ return C(_extends({
1110
+ pathname: d.pathname,
1111
+ hash: "",
1112
+ search: ""
1113
+ }, "string" === typeof a ? J(a) : a, {
1106
1114
  state: e,
1107
1115
  key: H()
1108
1116
  }));
@@ -1326,47 +1334,58 @@ function processNavigateUrl(option) {
1326
1334
  return pathPieces;
1327
1335
  }
1328
1336
 
1329
- function navigate(option, method) {
1330
- var success = option.success,
1331
- complete = option.complete,
1332
- fail = option.fail;
1333
- var failReason;
1334
-
1335
- try {
1336
- if ('url' in option) {
1337
- var pathPieces = processNavigateUrl(option);
1338
- var state = {
1339
- timestamp: Date.now()
1340
- };
1337
+ function navigate(_x, _x2) {
1338
+ return _navigate.apply(this, arguments);
1339
+ }
1341
1340
 
1342
- if (method === 'navigateTo') {
1343
- exports.history.push(pathPieces, state);
1344
- } else if (method === 'redirectTo') {
1345
- exports.history.replace(pathPieces, state);
1346
- }
1347
- } else if (method === 'navigateBack') {
1348
- setHistoryBackDelta(option.delta);
1349
- exports.history.go(-option.delta);
1350
- }
1351
- } catch (error) {
1352
- failReason = error;
1353
- }
1341
+ function _navigate() {
1342
+ _navigate = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee2(option, method) {
1343
+ return regeneratorRuntime.wrap(function _callee2$(_context2) {
1344
+ while (1) {
1345
+ switch (_context2.prev = _context2.next) {
1346
+ case 0:
1347
+ return _context2.abrupt("return", new Promise(function (resolve, reject) {
1348
+ var success = option.success,
1349
+ complete = option.complete,
1350
+ fail = option.fail;
1351
+ var unListen = exports.history.listen(function () {
1352
+ success === null || success === void 0 ? void 0 : success();
1353
+ complete === null || complete === void 0 ? void 0 : complete();
1354
+ resolve();
1355
+ unListen();
1356
+ });
1354
1357
 
1355
- return new Promise(function (resolve, reject) {
1356
- if (failReason) {
1357
- fail && fail(failReason);
1358
- complete && complete();
1359
- reject(failReason);
1360
- return;
1361
- }
1358
+ try {
1359
+ if ('url' in option) {
1360
+ var pathPieces = processNavigateUrl(option);
1361
+ var state = {
1362
+ timestamp: Date.now()
1363
+ };
1364
+
1365
+ if (method === 'navigateTo') {
1366
+ exports.history.push(pathPieces, state);
1367
+ } else if (method === 'redirectTo') {
1368
+ exports.history.replace(pathPieces, state);
1369
+ }
1370
+ } else if (method === 'navigateBack') {
1371
+ setHistoryBackDelta(option.delta);
1372
+ exports.history.go(-option.delta);
1373
+ }
1374
+ } catch (error) {
1375
+ fail === null || fail === void 0 ? void 0 : fail(error);
1376
+ complete === null || complete === void 0 ? void 0 : complete();
1377
+ reject(error);
1378
+ }
1379
+ }));
1362
1380
 
1363
- var unlisten = exports.history.listen(function () {
1364
- success && success();
1365
- complete && complete();
1366
- resolve();
1367
- unlisten();
1368
- });
1369
- });
1381
+ case 1:
1382
+ case "end":
1383
+ return _context2.stop();
1384
+ }
1385
+ }
1386
+ }, _callee2);
1387
+ }));
1388
+ return _navigate.apply(this, arguments);
1370
1389
  }
1371
1390
 
1372
1391
  function navigateTo(option) {
@@ -3000,7 +3019,7 @@ function createRouter(app, config, framework) {
3000
3019
  }, _callee, null, [[2, 8]]);
3001
3020
  }));
3002
3021
 
3003
- return function (_x) {
3022
+ return function (_x3) {
3004
3023
  return _ref4.apply(this, arguments);
3005
3024
  };
3006
3025
  }(), 500);
@@ -3355,7 +3374,7 @@ var initPxTransform = getInitPxTransform$1(taro);
3355
3374
  var requirePlugin = permanentlyNotSupport('requirePlugin');
3356
3375
 
3357
3376
  var getApp = function getApp() {
3358
- return taro._$app;
3377
+ return getCurrentInstance().app;
3359
3378
  };
3360
3379
 
3361
3380
  var pxTransform = function pxTransform(size) {
@@ -6370,11 +6389,14 @@ function _previewImage() {
6370
6389
  function loadImage(url, fail) {
6371
6390
  return new Promise(function (resolve) {
6372
6391
  var item = document.createElement('taro-swiper-item-core');
6373
- item.style.cssText = "\n display: flex;\n align-items: center;\n justify-content: center;\n ";
6392
+ item.style.cssText = "\n display: flex;\n align-items: start;\n justify-content: center;\n overflow-y: scroll;\n ";
6374
6393
  var image = new Image();
6375
6394
  image.style.maxWidth = '100%';
6376
6395
  image.src = url;
6377
- item.appendChild(image); // Note: 等待图片加载完后返回,会导致轮播被卡住
6396
+ var div = document.createElement('div');
6397
+ div.style.cssText = "\n display: flex;\n align-items: center;\n justify-content: center;\n max-width: 100%;\n min-height: 100%;\n ";
6398
+ div.appendChild(image);
6399
+ item.appendChild(div); // Note: 等待图片加载完后返回,会导致轮播被卡住
6378
6400
 
6379
6401
  resolve(item);
6380
6402
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tarojs/taro-h5",
3
- "version": "3.3.12",
3
+ "version": "3.3.13",
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.12",
37
- "@tarojs/router": "3.3.12",
38
- "@tarojs/runtime": "3.3.12",
36
+ "@tarojs/api": "3.3.13",
37
+ "@tarojs/router": "3.3.13",
38
+ "@tarojs/runtime": "3.3.13",
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": "0d7650ee4263efafacd87b9c8b69bb29b2a852c0"
48
+ "gitHead": "d84177a97cc27c01ca63c9dd07e5ab5bbaa91d8a"
49
49
  }
@@ -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: center;
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
- item.appendChild(image)
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') {
package/src/taro/index.js CHANGED
@@ -85,7 +85,7 @@ const initPxTransform = getInitPxTransform(taro)
85
85
 
86
86
  const requirePlugin = permanentlyNotSupport('requirePlugin')
87
87
  const getApp = function () {
88
- return taro._$app
88
+ return getCurrentInstance().app
89
89
  }
90
90
 
91
91
  const pxTransform = function (size) {