@tarojs/router 3.6.22-nightly.0 → 3.6.22
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 +44 -21
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +44 -20
- package/dist/index.esm.js.map +1 -1
- package/dist/router/multi-page.d.ts +1 -0
- package/dist/router/multi-page.js +12 -1
- package/dist/router/page.d.ts +1 -0
- package/dist/router/page.js +13 -2
- package/dist/router/spa.js +18 -5
- package/dist/style.d.ts +1 -0
- package/dist/style.js +1 -1
- package/dist/utils/navigate.d.ts +2 -4
- package/dist/utils/navigate.js +2 -16
- package/package.json +3 -3
package/dist/router/spa.js
CHANGED
|
@@ -48,7 +48,7 @@ export function createRouter(app, config, framework) {
|
|
|
48
48
|
(_a = app.onLaunch) === null || _a === void 0 ? void 0 : _a.call(app, launchParam);
|
|
49
49
|
app.onError && window.addEventListener('error', e => { var _a; return (_a = app.onError) === null || _a === void 0 ? void 0 : _a.call(app, e.message); });
|
|
50
50
|
const render = ({ location, action }) => __awaiter(this, void 0, void 0, function* () {
|
|
51
|
-
var _c, _d, _e, _f, _g, _h;
|
|
51
|
+
var _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
52
52
|
handler.pathname = decodeURI(location.pathname);
|
|
53
53
|
if ((_c = window.__taroAppConfig) === null || _c === void 0 ? void 0 : _c.usingWindowScroll)
|
|
54
54
|
window.scrollTo(0, 0);
|
|
@@ -77,22 +77,35 @@ export function createRouter(app, config, framework) {
|
|
|
77
77
|
window.location.reload();
|
|
78
78
|
}
|
|
79
79
|
else {
|
|
80
|
-
throw
|
|
80
|
+
throw error;
|
|
81
81
|
}
|
|
82
82
|
}
|
|
83
83
|
if (!element)
|
|
84
84
|
return;
|
|
85
85
|
const pageConfig = handler.pageConfig;
|
|
86
86
|
let enablePullDownRefresh = ((_e = config === null || config === void 0 ? void 0 : config.window) === null || _e === void 0 ? void 0 : _e.enablePullDownRefresh) || false;
|
|
87
|
+
let navigationStyle = ((_f = config === null || config === void 0 ? void 0 : config.window) === null || _f === void 0 ? void 0 : _f.navigationStyle) || 'default';
|
|
88
|
+
let navigationBarTextStyle = ((_g = config === null || config === void 0 ? void 0 : config.window) === null || _g === void 0 ? void 0 : _g.navigationBarTextStyle) || 'white';
|
|
89
|
+
let navigationBarBackgroundColor = ((_h = config === null || config === void 0 ? void 0 : config.window) === null || _h === void 0 ? void 0 : _h.navigationBarBackgroundColor) || '#000000';
|
|
87
90
|
if (pageConfig) {
|
|
88
|
-
setTitle((
|
|
91
|
+
setTitle((_j = pageConfig.navigationBarTitleText) !== null && _j !== void 0 ? _j : document.title);
|
|
89
92
|
if (typeof pageConfig.enablePullDownRefresh === 'boolean') {
|
|
90
93
|
enablePullDownRefresh = pageConfig.enablePullDownRefresh;
|
|
91
94
|
}
|
|
95
|
+
if (typeof pageConfig.navigationStyle === 'string') {
|
|
96
|
+
navigationStyle = pageConfig.navigationStyle;
|
|
97
|
+
}
|
|
98
|
+
if (typeof pageConfig.navigationBarTextStyle === 'string') {
|
|
99
|
+
navigationBarTextStyle = pageConfig.navigationBarTextStyle;
|
|
100
|
+
}
|
|
101
|
+
if (typeof pageConfig.navigationBarBackgroundColor === 'string') {
|
|
102
|
+
navigationBarBackgroundColor = pageConfig.navigationBarBackgroundColor;
|
|
103
|
+
}
|
|
92
104
|
}
|
|
105
|
+
eventCenter.trigger('__taroSetNavigationStyle', navigationStyle, navigationBarTextStyle, navigationBarBackgroundColor);
|
|
93
106
|
const currentPage = Current.page;
|
|
94
107
|
const pathname = handler.pathname;
|
|
95
|
-
const methodName = (
|
|
108
|
+
const methodName = (_k = stacks.method) !== null && _k !== void 0 ? _k : '';
|
|
96
109
|
const cacheTabs = stacks.getTabs();
|
|
97
110
|
let shouldLoad = false;
|
|
98
111
|
stacks.method = '';
|
|
@@ -158,7 +171,7 @@ export function createRouter(app, config, framework) {
|
|
|
158
171
|
shouldLoad = true;
|
|
159
172
|
}
|
|
160
173
|
if (shouldLoad || stacks.length < 1) {
|
|
161
|
-
const el = (
|
|
174
|
+
const el = (_l = element.default) !== null && _l !== void 0 ? _l : element;
|
|
162
175
|
const loadConfig = Object.assign({}, pageConfig);
|
|
163
176
|
const stacksIndex = stacks.length;
|
|
164
177
|
delete loadConfig['path'];
|
package/dist/style.d.ts
CHANGED
package/dist/style.js
CHANGED
package/dist/utils/navigate.d.ts
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
export declare
|
|
1
|
+
export declare const isWeixin: () => boolean;
|
|
2
|
+
export declare const isDingTalk: () => boolean;
|
|
3
3
|
export declare function setTitle(title: string): Promise<string>;
|
|
4
|
-
export declare function isWeixin(): boolean;
|
|
5
|
-
export declare function isDingTalk(): boolean;
|
package/dist/utils/navigate.js
CHANGED
|
@@ -7,16 +7,10 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
7
7
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
8
|
});
|
|
9
9
|
};
|
|
10
|
-
import MobileDetect from 'mobile-detect';
|
|
11
|
-
let md;
|
|
12
10
|
let preTitle = document.title;
|
|
13
11
|
let isLoadDdEntry = false;
|
|
14
|
-
export
|
|
15
|
-
|
|
16
|
-
md = new MobileDetect(navigator.userAgent);
|
|
17
|
-
}
|
|
18
|
-
return md;
|
|
19
|
-
}
|
|
12
|
+
export const isWeixin = () => !!navigator.userAgent.match(/\bMicroMessenger\b/ig);
|
|
13
|
+
export const isDingTalk = () => !!navigator.userAgent.match(/\bDingTalk\b/ig);
|
|
20
14
|
export function setTitle(title) {
|
|
21
15
|
return __awaiter(this, void 0, void 0, function* () {
|
|
22
16
|
if (preTitle === title)
|
|
@@ -34,11 +28,3 @@ export function setTitle(title) {
|
|
|
34
28
|
return title;
|
|
35
29
|
});
|
|
36
30
|
}
|
|
37
|
-
export function isWeixin() {
|
|
38
|
-
const md = getMobileDetect();
|
|
39
|
-
return md.match(/MicroMessenger/ig);
|
|
40
|
-
}
|
|
41
|
-
export function isDingTalk() {
|
|
42
|
-
const md = getMobileDetect();
|
|
43
|
-
return md.match(/DingTalk/ig);
|
|
44
|
-
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tarojs/router",
|
|
3
|
-
"version": "3.6.22
|
|
3
|
+
"version": "3.6.22",
|
|
4
4
|
"description": "Taro-router",
|
|
5
5
|
"browser": "dist/index.esm.js",
|
|
6
6
|
"main:h5": "dist/index.js",
|
|
@@ -27,8 +27,8 @@
|
|
|
27
27
|
"mobile-detect": "^1.4.2",
|
|
28
28
|
"query-string": "^7.1.1",
|
|
29
29
|
"universal-router": "^8.3.0",
|
|
30
|
-
"@tarojs/
|
|
31
|
-
"@tarojs/
|
|
30
|
+
"@tarojs/runtime": "3.6.22",
|
|
31
|
+
"@tarojs/taro": "3.6.22"
|
|
32
32
|
},
|
|
33
33
|
"devDependencies": {
|
|
34
34
|
"@rollup/plugin-commonjs": "^20.0.0",
|