@tarojs/taro-h5 3.3.15 → 3.3.16

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.
Files changed (2) hide show
  1. package/dist/index.cjs.js +22 -10
  2. package/package.json +5 -5
package/dist/index.cjs.js CHANGED
@@ -1308,6 +1308,17 @@ var Stacks = /*#__PURE__*/function () {
1308
1308
  value: function getItem(index) {
1309
1309
  return this.stacks[index];
1310
1310
  }
1311
+ }, {
1312
+ key: "getLastIndex",
1313
+ value: function getLastIndex(pathname) {
1314
+ var list = _toConsumableArray(this.stacks).reverse();
1315
+
1316
+ return list.findIndex(function (page) {
1317
+ var _a;
1318
+
1319
+ return ((_a = page.path) === null || _a === void 0 ? void 0 : _a.replace(/\?.*/g, '')) === pathname;
1320
+ });
1321
+ }
1311
1322
  }, {
1312
1323
  key: "getDelta",
1313
1324
  value: function getDelta(pathname) {
@@ -1316,17 +1327,18 @@ var Stacks = /*#__PURE__*/function () {
1316
1327
  } // NOTE: 此处为了修复浏览器后退多级页面,在大量重复路由状况下可能出现判断错误的情况 (增强判断能力只能考虑在 query 中新增参数来判断,暂时搁置)
1317
1328
 
1318
1329
 
1319
- var prevIndex = this.stacks.findIndex(function (r) {
1320
- var _a;
1321
-
1322
- return ((_a = r.path) === null || _a === void 0 ? void 0 : _a.replace(/\?.*/g, '')) === pathname;
1323
- });
1324
- return this.length - 1 - prevIndex;
1330
+ return this.getLastIndex(pathname) || 1;
1325
1331
  }
1326
1332
  }, {
1327
1333
  key: "getPrevIndex",
1328
1334
  value: function getPrevIndex(pathname) {
1329
- return this.length - 1 - this.getDelta(pathname);
1335
+ var lastIndex = this.getLastIndex(pathname);
1336
+
1337
+ if (lastIndex < 0) {
1338
+ return -1;
1339
+ }
1340
+
1341
+ return this.length - 1 - lastIndex;
1330
1342
  }
1331
1343
  }, {
1332
1344
  key: "pop",
@@ -2856,13 +2868,13 @@ var qs = function qs() {
2856
2868
  function pageOnReady(page) {
2857
2869
  var onLoad = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
2858
2870
 
2859
- var _a;
2871
+ var _a, _b;
2860
2872
 
2861
2873
  var pageEl = document.getElementById(page.path);
2862
2874
 
2863
2875
  if (pageEl && !(pageEl === null || pageEl === void 0 ? void 0 : pageEl['__isReady'])) {
2864
2876
  var el = pageEl.firstElementChild;
2865
- (_a = el === null || el === void 0 ? void 0 : el['componentOnReady']) === null || _a === void 0 ? void 0 : _a.call(el).then(function () {
2877
+ (_b = (_a = el === null || el === void 0 ? void 0 : el['componentOnReady']) === null || _a === void 0 ? void 0 : _a.call(el)) === null || _b === void 0 ? void 0 : _b.then(function () {
2866
2878
  runtime.requestAnimationFrame(function () {
2867
2879
  page.onReady();
2868
2880
  pageEl['__isReady'] = true;
@@ -3087,7 +3099,7 @@ function createRouter(app, config, framework) {
3087
3099
  shouldLoad = true;
3088
3100
 
3089
3101
  case 46:
3090
- if (!shouldLoad) {
3102
+ if (!(shouldLoad || stacks.length < 1)) {
3091
3103
  _context.next = 54;
3092
3104
  break;
3093
3105
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tarojs/taro-h5",
3
- "version": "3.3.15",
3
+ "version": "3.3.16",
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.15",
37
- "@tarojs/router": "3.3.15",
38
- "@tarojs/runtime": "3.3.15",
36
+ "@tarojs/api": "3.3.16",
37
+ "@tarojs/router": "3.3.16",
38
+ "@tarojs/runtime": "3.3.16",
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": "4a11ab9a8950f6a580e1278c160f6b4aaa8ac4f2"
48
+ "gitHead": "75d3de695c98fab79998612ef87567a68ea981a7"
49
49
  }