mod: 细节调整

This commit is contained in:
张传龙 2022-06-17 23:05:57 +08:00
parent ae43ffb94f
commit ef33b28492
2 changed files with 7 additions and 6 deletions

View File

@ -1,17 +1,18 @@
<template>
<n-breadcrumb>
<n-breadcrumb-item v-for="item in currentRoute.matched" :key="item.path" @click="handleBreadClick(item.path)">
<n-breadcrumb-item v-for="item in route.matched" :key="item.path" @click="handleBreadClick(item.path)">
{{ item.meta.title }}
</n-breadcrumb-item>
</n-breadcrumb>
</template>
<script setup>
import { router } from '@/router'
const { currentRoute } = router
import { useRouter, useRoute } from 'vue-router'
const router = useRouter()
const route = useRoute()
function handleBreadClick(path) {
if (path === currentRoute.value.path) return
if (path === route.path) return
router.push(path)
}
</script>

View File

@ -38,10 +38,10 @@ export const useUserStore = defineStore('user', {
return Promise.reject(error)
}
},
logout() {
toLogin()
async logout() {
removeToken()
this.userInfo = {}
toLogin()
},
setUserInfo(userInfo = {}) {
this.userInfo = { ...this.userInfo, ...userInfo }