feat: 集成重新加载页面功能

This commit is contained in:
张传龙
2022-04-21 22:35:26 +08:00
parent 585bf4a4c4
commit 3c46d2c159
4 changed files with 43 additions and 8 deletions

23
src/store/modules/app.js Normal file
View File

@@ -0,0 +1,23 @@
import { defineStore } from 'pinia'
import { nextTick } from 'vue'
export const useAppStore = defineStore('app', {
state() {
return {
reloadFlag: true,
}
},
actions: {
async reloadPage() {
$loadingBar.start()
this.reloadFlag = false
await nextTick()
this.reloadFlag = true
setTimeout(() => {
document.documentElement.scrollTo({ left: 0, top: 0 })
$loadingBar.finish()
}, 100)
},
},
})