feat: persistant refresh (no url change)

This commit is contained in:
Methapon2001 2023-12-07 14:28:48 +07:00
parent eb6184f80d
commit f328d1fb32
No known key found for this signature in database
GPG key ID: 849924FEF46BD132
2 changed files with 9 additions and 1 deletions

View file

@ -48,7 +48,13 @@ async function submitFolderForm(value: {
} }
} }
onMounted(getCabinet) onMounted(async () => {
await getCabinet()
const sessionCurrentPath = sessionStorage.getItem('currentPath')
if (sessionCurrentPath) await getFolder(sessionCurrentPath)
})
</script> </script>
<template> <template>
<section id="header" class="q-px-md q-pt-md q-pb-none"> <section id="header" class="q-px-md q-pt-md q-pb-none">

View file

@ -62,6 +62,8 @@ export const useTreeDataStore = defineStore('changeCabinet', () => {
async function getFolder(pathname: string, updateStatus = true) { async function getFolder(pathname: string, updateStatus = true) {
loader.show() loader.show()
sessionStorage.setItem('currentPath', pathname)
const pathArray: string[] = pathname.split('/').filter(Boolean) const pathArray: string[] = pathname.split('/').filter(Boolean)
currentDept.value = pathArray.length currentDept.value = pathArray.length