-
Notifications
You must be signed in to change notification settings - Fork 834
Open
Description
1、ABC三个页面 C是缓存页面
2、A先进入C 携带的参数是 query:{id: 1} 这个时候页签store里存的c的path对应的数据包括参数是query:{id: 1}
3、B然后进入C 携带的参数是 query:{id: 2} 这个时候页签store里存的c的path对应的数据包括参数仍然是query:{id: 1}
4、所以就会导致 我去了其他页面 再点击页签回到C的时候 参数就会一直是第一次存进去的数据 永远不会是最新的
5、主要是这行代码 如果c存在了 就直接return出来了
6、解决方案:
每次进入C页面的时候 判断一下store里有没有这个c的数据 如果有就替换 没有才push进去
// 新增tag
addVisitedView(view: RouteLocationNormalizedLoaded) {
if (view.meta?.noTagsView) return
const findIndex = this.visitedViews.findIndex((v) => v.path === view.path)
if (findIndex !== -1) {
this.visitedViews[findIndex] = Object.assign({}, view, {
title: view.meta?.title || 'no-name'
})
} else {
this.visitedViews.push(
Object.assign({}, view, {
title: view.meta?.title || 'no-name'
})
)
}
}

Metadata
Metadata
Assignees
Labels
No labels