Refactor API requests and update global methods
This commit is contained in:
@ -37,7 +37,7 @@
|
||||
</div>
|
||||
<div class="absolute right-[10px] flex items-center">
|
||||
<div class="h-[36px] w-[36px] border-rd-[50%] bg-[#F5F5F5] text-center line-height-[44px]">
|
||||
<img v-if="!isLogin" src="~/assets/images/user.png" alt="" srcset="" class="h-[19px] w-[17px]" />
|
||||
<img v-if="!isLogin" src="~/assets/images/user.png" alt="" srcset="" class="h-[19px] w-[17px] relative top-[7px] left-[10px]" />
|
||||
<img v-else :src="userStore.userInfoRes.avatar" alt="" srcset="" class="h-[19px] w-[17px] rd-[50%]" />
|
||||
</div>
|
||||
<span v-if="!isLogin" class="ml-[14px] cursor-pointer text-[14px] text-[#1A65FF] font-normal" @click="handleLogin">立即登录</span>
|
||||
@ -69,8 +69,7 @@
|
||||
import { Search } from '@element-plus/icons-vue'
|
||||
import useUserStore from '~/store/user'
|
||||
const userStore = useUserStore()
|
||||
const { $openLogin } = useNuxtApp()
|
||||
|
||||
const app = useNuxtApp()
|
||||
|
||||
const props = defineProps({
|
||||
active: {
|
||||
@ -174,7 +173,7 @@
|
||||
}
|
||||
}
|
||||
const handleLogin = () => {
|
||||
// $openLogin()
|
||||
app?.$openLogin() // 调用全局方法
|
||||
}
|
||||
const handleCommand = (command: string) => {
|
||||
if (command === '退出') {
|
||||
|
||||
Reference in New Issue
Block a user