mirror of
https://gitee.com/niucloud-team/niucloud-admin.git
synced 2026-01-29 22:38:10 +00:00
32 lines
665 B
TypeScript
32 lines
665 B
TypeScript
import { defineStore } from 'pinia'
|
|
import { nextTick } from 'vue'
|
|
import NProgress from 'nprogress'
|
|
|
|
interface App {
|
|
route: string,
|
|
routeRefreshTag: boolean,
|
|
pageReturn: boolean
|
|
}
|
|
|
|
const useAppStore = defineStore('app', {
|
|
state: (): App => {
|
|
return {
|
|
route: '',
|
|
routeRefreshTag: true,
|
|
pageReturn: false
|
|
}
|
|
},
|
|
actions: {
|
|
refreshRouterView() {
|
|
this.routeRefreshTag = false
|
|
NProgress.start()
|
|
|
|
nextTick(() => {
|
|
this.routeRefreshTag = true
|
|
NProgress.done()
|
|
})
|
|
}
|
|
}
|
|
})
|
|
|
|
export default useAppStore |