mirror of
https://github.com/un-pany/v3-admin-vite.git
synced 2025-04-20 19:09:21 +08:00
fix: 缓存标签栏数据时,删除不必要的属性,防止 JSON.stringify 处理到循环引用
This commit is contained in:
parent
e2ebc1da85
commit
c3ad3c0ce1
5
src/utils/cache/local-storage.ts
vendored
5
src/utils/cache/local-storage.ts
vendored
@ -43,6 +43,11 @@ export const getVisitedViews = () => {
|
||||
return JSON.parse(json ?? "[]") as TagView[]
|
||||
}
|
||||
export const setVisitedViews = (views: TagView[]) => {
|
||||
views.forEach((view) => {
|
||||
// 删除不必要的属性,防止 JSON.stringify 处理到循环引用
|
||||
delete view.matched
|
||||
delete view.redirectedFrom
|
||||
})
|
||||
localStorage.setItem(CacheKey.VISITED_VIEWS, JSON.stringify(views))
|
||||
}
|
||||
export const getCachedViews = () => {
|
||||
|
Loading…
x
Reference in New Issue
Block a user