@tarojs/router 3.6.31-canary.1 → 3.6.32

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
@@ -45,7 +45,7 @@ body {
45
45
  /**
46
46
  * 插入路由相关样式
47
47
  */
48
- function loadRouterStyle(enableTabBar, enableWindowScroll) {
48
+ function loadRouterStyle(enableTabBar, enableWindowScroll, enhanceAnimation) {
49
49
  const css = `
50
50
  .taro_router {
51
51
  position: relative;
@@ -73,11 +73,15 @@ ${enableTabBar ? `
73
73
  }
74
74
 
75
75
  ` : ''}
76
- .taro_page_shade:has(+.taro_page_stationed),
76
+ ${enhanceAnimation
77
+ ? `.taro_page_shade:has(+.taro_page_stationed),
77
78
  .taro_page_shade.taro_tabbar_page,
78
79
  .taro_router > .taro_page.taro_page_show.taro_page_stationed:not(.taro_page_shade):not(.taro_tabbar_page):not(:last-child):has(+.taro_page_stationed) {
79
80
  display: none;
80
- }
81
+ }` : ` .taro_page_shade,
82
+ .taro_router > .taro_page.taro_page_show.taro_page_stationed:not(.taro_page_shade):not(.taro_tabbar_page):not(:last-child) {
83
+ display: none;
84
+ }`}
81
85
  `;
82
86
  addStyle(css);
83
87
  }
@@ -1258,7 +1262,7 @@ class PageHandler {
1258
1262
  this.pathname = exports.history.location.pathname;
1259
1263
  // Note: 注入页面样式
1260
1264
  this.animation && loadAnimateStyle(this.animationDuration);
1261
- loadRouterStyle(this.tabBarList.length > 1, this.usingWindowScroll);
1265
+ loadRouterStyle(this.tabBarList.length > 1, this.usingWindowScroll, this.router.enhanceAnimation);
1262
1266
  }
1263
1267
  onReady(page, onLoad = true) {
1264
1268
  var _a;
@@ -1382,7 +1386,7 @@ class PageHandler {
1382
1386
  }
1383
1387
  }
1384
1388
  hide(page, animation = false) {
1385
- var _a, _b, _c, _d, _e, _f, _g;
1389
+ var _a, _b, _c, _d, _e, _f, _g, _h;
1386
1390
  if (!page)
1387
1391
  return;
1388
1392
  // NOTE: 修复多页并发问题,此处可能因为路由跳转过快,执行时页面可能还没有创建成功
@@ -1407,6 +1411,7 @@ class PageHandler {
1407
1411
  this.hideTimer = null;
1408
1412
  (_g = (_f = (_e = this.lastHidePage) === null || _e === void 0 ? void 0 : _e.classList) === null || _f === void 0 ? void 0 : _f.add) === null || _g === void 0 ? void 0 : _g.call(_f, 'taro_page_shade');
1409
1413
  }
1414
+ (_h = page.onHide) === null || _h === void 0 ? void 0 : _h.call(page);
1410
1415
  pageEl.classList.add('taro_page_shade');
1411
1416
  this.lastHidePage = pageEl;
1412
1417
  }
package/dist/index.esm.js CHANGED
@@ -44,7 +44,7 @@ body {
44
44
  /**
45
45
  * 插入路由相关样式
46
46
  */
47
- function loadRouterStyle(enableTabBar, enableWindowScroll) {
47
+ function loadRouterStyle(enableTabBar, enableWindowScroll, enhanceAnimation) {
48
48
  const css = `
49
49
  .taro_router {
50
50
  position: relative;
@@ -72,11 +72,15 @@ ${enableTabBar ? `
72
72
  }
73
73
 
74
74
  ` : ''}
75
- .taro_page_shade:has(+.taro_page_stationed),
75
+ ${enhanceAnimation
76
+ ? `.taro_page_shade:has(+.taro_page_stationed),
76
77
  .taro_page_shade.taro_tabbar_page,
77
78
  .taro_router > .taro_page.taro_page_show.taro_page_stationed:not(.taro_page_shade):not(.taro_tabbar_page):not(:last-child):has(+.taro_page_stationed) {
78
79
  display: none;
79
- }
80
+ }` : ` .taro_page_shade,
81
+ .taro_router > .taro_page.taro_page_show.taro_page_stationed:not(.taro_page_shade):not(.taro_tabbar_page):not(:last-child) {
82
+ display: none;
83
+ }`}
80
84
  `;
81
85
  addStyle(css);
82
86
  }
@@ -1257,7 +1261,7 @@ class PageHandler {
1257
1261
  this.pathname = history.location.pathname;
1258
1262
  // Note: 注入页面样式
1259
1263
  this.animation && loadAnimateStyle(this.animationDuration);
1260
- loadRouterStyle(this.tabBarList.length > 1, this.usingWindowScroll);
1264
+ loadRouterStyle(this.tabBarList.length > 1, this.usingWindowScroll, this.router.enhanceAnimation);
1261
1265
  }
1262
1266
  onReady(page, onLoad = true) {
1263
1267
  var _a;
@@ -1381,7 +1385,7 @@ class PageHandler {
1381
1385
  }
1382
1386
  }
1383
1387
  hide(page, animation = false) {
1384
- var _a, _b, _c, _d, _e, _f, _g;
1388
+ var _a, _b, _c, _d, _e, _f, _g, _h;
1385
1389
  if (!page)
1386
1390
  return;
1387
1391
  // NOTE: 修复多页并发问题,此处可能因为路由跳转过快,执行时页面可能还没有创建成功
@@ -1406,6 +1410,7 @@ class PageHandler {
1406
1410
  this.hideTimer = null;
1407
1411
  (_g = (_f = (_e = this.lastHidePage) === null || _e === void 0 ? void 0 : _e.classList) === null || _f === void 0 ? void 0 : _f.add) === null || _g === void 0 ? void 0 : _g.call(_f, 'taro_page_shade');
1408
1412
  }
1413
+ (_h = page.onHide) === null || _h === void 0 ? void 0 : _h.call(page);
1409
1414
  pageEl.classList.add('taro_page_shade');
1410
1415
  this.lastHidePage = pageEl;
1411
1416
  }
@@ -123,7 +123,7 @@ class PageHandler {
123
123
  this.pathname = history.location.pathname;
124
124
  // Note: 注入页面样式
125
125
  this.animation && loadAnimateStyle(this.animationDuration);
126
- loadRouterStyle(this.tabBarList.length > 1, this.usingWindowScroll);
126
+ loadRouterStyle(this.tabBarList.length > 1, this.usingWindowScroll, this.router.enhanceAnimation);
127
127
  }
128
128
  onReady(page, onLoad = true) {
129
129
  var _a;
@@ -247,7 +247,7 @@ class PageHandler {
247
247
  }
248
248
  }
249
249
  hide(page, animation = false) {
250
- var _a, _b, _c, _d, _e, _f, _g;
250
+ var _a, _b, _c, _d, _e, _f, _g, _h;
251
251
  if (!page)
252
252
  return;
253
253
  // NOTE: 修复多页并发问题,此处可能因为路由跳转过快,执行时页面可能还没有创建成功
@@ -272,6 +272,7 @@ class PageHandler {
272
272
  this.hideTimer = null;
273
273
  (_g = (_f = (_e = this.lastHidePage) === null || _e === void 0 ? void 0 : _e.classList) === null || _f === void 0 ? void 0 : _f.add) === null || _g === void 0 ? void 0 : _g.call(_f, 'taro_page_shade');
274
274
  }
275
+ (_h = page.onHide) === null || _h === void 0 ? void 0 : _h.call(page);
275
276
  pageEl.classList.add('taro_page_shade');
276
277
  this.lastHidePage = pageEl;
277
278
  }
package/dist/style.d.ts CHANGED
@@ -5,7 +5,7 @@ declare function loadAnimateStyle(ms?: number): void;
5
5
  /**
6
6
  * 插入路由相关样式
7
7
  */
8
- declare function loadRouterStyle(enableTabBar: boolean, enableWindowScroll: boolean): void;
8
+ declare function loadRouterStyle(enableTabBar: boolean, enableWindowScroll: boolean, enhanceAnimation?: boolean): void;
9
9
  /**
10
10
  * 插入导航栏相关的样式
11
11
  */
package/dist/style.js CHANGED
@@ -34,7 +34,7 @@ body {
34
34
  /**
35
35
  * 插入路由相关样式
36
36
  */
37
- function loadRouterStyle(enableTabBar, enableWindowScroll) {
37
+ function loadRouterStyle(enableTabBar, enableWindowScroll, enhanceAnimation) {
38
38
  const css = `
39
39
  .taro_router {
40
40
  position: relative;
@@ -62,11 +62,15 @@ ${enableTabBar ? `
62
62
  }
63
63
 
64
64
  ` : ''}
65
- .taro_page_shade:has(+.taro_page_stationed),
65
+ ${enhanceAnimation
66
+ ? `.taro_page_shade:has(+.taro_page_stationed),
66
67
  .taro_page_shade.taro_tabbar_page,
67
68
  .taro_router > .taro_page.taro_page_show.taro_page_stationed:not(.taro_page_shade):not(.taro_tabbar_page):not(:last-child):has(+.taro_page_stationed) {
68
69
  display: none;
69
- }
70
+ }` : ` .taro_page_shade,
71
+ .taro_router > .taro_page.taro_page_show.taro_page_stationed:not(.taro_page_shade):not(.taro_tabbar_page):not(:last-child) {
72
+ display: none;
73
+ }`}
70
74
  `;
71
75
  addStyle(css);
72
76
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tarojs/router",
3
- "version": "3.6.31-canary.1",
3
+ "version": "3.6.32",
4
4
  "description": "Taro-router",
5
5
  "browser": "dist/index.js",
6
6
  "main:h5": "dist/index.esm.js",
@@ -44,14 +44,14 @@
44
44
  "rollup-plugin-ts": "^3.0.2",
45
45
  "ts-jest": "^29.0.5",
46
46
  "typescript": "^4.7.4",
47
- "@tarojs/runtime": "3.6.31-canary.1",
48
- "@tarojs/shared": "3.6.31-canary.1",
49
- "@tarojs/taro": "3.6.31-canary.1"
47
+ "@tarojs/shared": "3.6.32",
48
+ "@tarojs/runtime": "3.6.32",
49
+ "@tarojs/taro": "3.6.32"
50
50
  },
51
51
  "peerDependencies": {
52
- "@tarojs/runtime": "3.6.31-canary.1",
53
- "@tarojs/taro": "3.6.31-canary.1",
54
- "@tarojs/shared": "3.6.31-canary.1"
52
+ "@tarojs/taro": "3.6.32",
53
+ "@tarojs/runtime": "3.6.32",
54
+ "@tarojs/shared": "3.6.32"
55
55
  },
56
56
  "scripts": {
57
57
  "prebuild": "pnpm run clean",
package/types/router.d.ts CHANGED
@@ -12,6 +12,8 @@ export interface Router {
12
12
  customRoutes?: Record<string, string | string[]>
13
13
  pathname: string
14
14
  forcePath?: string
15
+ /** 加上这个参数,可以解决返回页面的时候白屏的问题,但是某些不支持 :has() 选择器的浏览器会有问题 */
16
+ enhanceAnimation?: boolean
15
17
  }
16
18
 
17
19
  export interface SpaRouterConfig extends AppConfig {