2024-11-28 12:57:22 +08:00

42 lines
548 B
Vue

<script setup>
import router from '@/router/index'
import {ref,onMounted} from 'vue'
const isLogging=()=>{
const user=localStorage.getItem('userInfo')
if(user){
console.log('登录中')
if(!JSON.parse(user).token){
return false
}
return true
}
return false
}
onMounted(()=>{
console.log(isLogging())
if(isLogging()){
router.replace({ path: "/index" })
}else{
router.replace({ path: "/login" })
}
})
</script>
<template>
<div> <RouterView /></div>
</template>
<style scoped>
</style>