forked from Mirrors/elk
chore: call only once useRoute
This commit is contained in:
parent
531392f967
commit
fcf712ef42
1 changed files with 3 additions and 2 deletions
|
@ -16,7 +16,8 @@ export default defineNuxtPlugin(() => {
|
||||||
return !!lastStatus.value[path]
|
return !!lastStatus.value[path]
|
||||||
},
|
},
|
||||||
restoreScrollPosition: () => {
|
restoreScrollPosition: () => {
|
||||||
const restore = lastStatus.value[useRoute().fullPath]
|
const fullPath = useRoute().fullPath
|
||||||
|
const restore = lastStatus.value[fullPath]
|
||||||
if (restore) {
|
if (restore) {
|
||||||
const el = restore.type === 'status'
|
const el = restore.type === 'status'
|
||||||
? document.getElementById(`status-${restore.id}`)
|
? document.getElementById(`status-${restore.id}`)
|
||||||
|
@ -28,7 +29,7 @@ export default defineNuxtPlugin(() => {
|
||||||
window.scrollTo(0, restore.position)
|
window.scrollTo(0, restore.position)
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
delete lastStatus.value[useRoute().fullPath]
|
delete lastStatus.value[fullPath]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in a new issue