Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(router): 修复获取当前路由path未过滤basename #10051

Merged
merged 23 commits into from
Aug 23, 2021
Merged
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
027e8d6
fix(jd): 修复京东小程序onLongPress事件失效
Jul 12, 2021
e3032e3
Revert "fix(jd): 修复京东小程序onLongPress事件失效"
Jul 12, 2021
fa8c98b
fix(jd): 修复京东小程序onLongPress事件失效
Jul 12, 2021
c6e6829
fix(jd): 修复京东小程序onLongPress事件失效
Jul 12, 2021
f49622f
Merge branch 'NervJS:next' into next
zhaomengfan Jul 27, 2021
6433dda
fix(router): 修复basename失效
Jul 27, 2021
08126f3
Merge branch 'next' into next
zhaomengfan Jul 27, 2021
c71415e
Merge branch 'next' into next
zhaomengfan Jul 28, 2021
a617c28
Merge branch 'next' into next
zhaomengfan Jul 29, 2021
e73773b
Merge branch 'next' into next
zhaomengfan Jul 30, 2021
a5d1033
Merge branch 'next' into next
zhaomengfan Jul 30, 2021
264aa26
Merge branch 'next' into next
zhaomengfan Jul 30, 2021
d974785
Merge branch 'next' into next
zhaomengfan Aug 2, 2021
629eeeb
Merge branch 'next' into next
zhaomengfan Aug 2, 2021
d8c9468
Merge branch 'next' into next
zhaomengfan Aug 2, 2021
5878a7f
Merge branch 'next' into next
zhaomengfan Aug 3, 2021
4a62ebe
Merge branch 'next' into next
Chen-jj Aug 3, 2021
5306f6d
Merge branch 'next' into next
zhaomengfan Aug 4, 2021
a06034b
Merge branch 'NervJS:next' into next
zhaomengfan Aug 4, 2021
b9145cb
Merge branch 'NervJS:next' into next
zhaomengfan Aug 6, 2021
60c51e2
Merge branch 'NervJS:next' into next
zhaomengfan Aug 14, 2021
d2427ee
fix(router): 修复获取当前路由path未过滤basename
Aug 14, 2021
e212476
Merge branch 'next' into next
luckyadam Aug 23, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions packages/taro-router/src/router.ts
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,8 @@ export function createRouter (
})
}

const router = new UniversalRouter(routes, { baseUrl: config.router.basename || '' })
const basename = config.router.basename
const router = new UniversalRouter(routes, { baseUrl: basename || '' })
app.onLaunch!()

const render: LocationListener<LocationState> = throttle(async ({ location, action }) => {
Expand Down Expand Up @@ -181,9 +182,11 @@ export function createRouter (
const config = { ...pageConfig }
delete config['path']
delete config['load']

const pathname = basename ? location.pathname.replace(basename, '') : location.pathname
const page = createPageConfig(
enablePullDownRefresh ? runtimeHooks.createPullDownComponent?.(el, location.pathname, framework, routerConfig.PullDownRefresh) : el,
location.pathname + stringify(qs(stacks.length)),
pathname + stringify(qs(stacks.length)),
{},
config
)
Expand Down