Skip to content

Commit

Permalink
Revert "fix(runtime-web): 页面返回时拿到上一个页面的 location (#130)" (#131)
Browse files Browse the repository at this point in the history
This reverts commit b2802cb.
  • Loading branch information
hwaphon authored Dec 5, 2023
1 parent b9ebfa1 commit 273f855
Showing 1 changed file with 2 additions and 8 deletions.
10 changes: 2 additions & 8 deletions packages/runtime-web/src/router/router.ts
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ function createPageConfig(pageConfig: IPage) {
let popping = false
export function tigaRouterChangeHandler(
e: { detail: IRouterChangeDetail },
component?: string
component: string
) {
const { action, delta } = e.detail || {}

Expand Down Expand Up @@ -266,13 +266,7 @@ function registerEventLister() {
const pageCreateEvent = 'tigaPageCreate' as any
window.addEventListener(
routerChangeEvent,
(event) => {
// 在调用 navigateBack 时,首先触发了 __tigaRouterChange 事件,然后再触发 history.back
// 这可能会导致后续页面在消费 location 时拿到的还是上一个页面的对象
setTimeout(() => {
tigaRouterChangeHandler(event)
})
},
tigaRouterChangeHandler as any,
false
)
window.addEventListener(pageCreateEvent, pageCreateHandler, false)
Expand Down

0 comments on commit 273f855

Please sign in to comment.