mirror of
https://gitee.com/chu1204505056/vue-admin-beautiful.git
synced 2025-04-06 03:58:00 +08:00
Update index.vue
fix use `this.$store this.$router this.$route` error in setup function with Vue3.0
This commit is contained in:
parent
e934394182
commit
beb97421d7
@ -22,20 +22,23 @@
|
||||
|
||||
import { useStore } from 'vuex'
|
||||
import { computed } from 'vue'
|
||||
import { useRoute, useRouter } from 'vue-router'
|
||||
|
||||
export default {
|
||||
name: 'VabAvatar',
|
||||
components: { DownOutlined },
|
||||
setup() {
|
||||
const store = useStore()
|
||||
|
||||
const router = useRouter();
|
||||
const route = useRoute();
|
||||
|
||||
const logout = async () => {
|
||||
await this.$store.dispatch('user/logout')
|
||||
await store.dispatch('user/logout')
|
||||
if (recordRoute) {
|
||||
const fullPath = this.$route.fullPath
|
||||
this.$router.push(`/login?redirect=${fullPath}`)
|
||||
const fullPath = route.fullPath
|
||||
router.push(`/login?redirect=${fullPath}`)
|
||||
} else {
|
||||
this.$router.push('/login')
|
||||
router.push('/login')
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user