Skip to content

Commit 863eb1d

Browse files
authored
fix ios abusolut url with new URL method problem (#11)
1 parent 6ee13ef commit 863eb1d

File tree

3 files changed

+9
-9
lines changed

3 files changed

+9
-9
lines changed

lerna.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,5 @@
1010
"registry": "https://registry.npmjs.org/"
1111
}
1212
},
13-
"version": "2.0.3"
13+
"version": "2.0.4"
1414
}

packages/nextjs/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "tarojs-plugin-platform-nextjs",
3-
"version": "2.0.3",
3+
"version": "2.0.4",
44
"description": "Taro 插件,用于编译为 Next.js 应用。",
55
"main": "lib/index.js",
66
"scripts": {

packages/nextjs/taro/src/internal/taroApp.tsx

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ class TaroApp {
4545
}
4646

4747
const base = isAbsoluteUrl(url) ? undefined : location.origin
48-
const urlObj = new URL(url, base)
48+
const urlObj = base ? new URL(url, base) : new URL(url)
4949

5050
let target = url
5151
if (!isAbsoluteUrl(url)) {
@@ -91,13 +91,13 @@ class TaroApp {
9191
}
9292

9393
const base = isAbsoluteUrl(url) ? undefined : location.origin
94-
const urlObj = new URL(url, base)
95-
94+
const urlObj = base ? new URL(url, base) : new URL(url)
95+
9696
const customRoute = this.customRoutes[urlObj.pathname]
9797
if (customRoute) {
9898
urlObj.pathname = customRoute
9999
}
100-
100+
101101
Router.router.push(urlObj.toString())
102102
.then(() => {
103103
const page: TaroPage = {
@@ -119,13 +119,13 @@ class TaroApp {
119119
}
120120

121121
const base = isAbsoluteUrl(url) ? undefined : location.origin
122-
const urlObj = new URL(url, base)
123-
122+
const urlObj = base ? new URL(url, base) : new URL(url)
123+
124124
const customRoute = this.customRoutes[urlObj.pathname]
125125
if (customRoute) {
126126
urlObj.pathname = customRoute
127127
}
128-
128+
129129
Router.router.push(urlObj.toString())
130130
.then(() => {
131131
const page: TaroPage = {

0 commit comments

Comments
 (0)