fix: search button issue

This commit is contained in:
tim
2025-08-12 01:29:50 +08:00
parent e2d812246a
commit 85fb1b8a27

View File

@@ -50,11 +50,12 @@
<script> <script>
import { authState, clearToken, loadCurrentUser } from '~/utils/auth' import { authState, clearToken, loadCurrentUser } from '~/utils/auth'
import { watch, nextTick } from 'vue' import { watch, nextTick, ref, computed } from 'vue'
import { fetchUnreadCount, notificationState } from '~/utils/notification' import { fetchUnreadCount, notificationState } from '~/utils/notification'
import DropdownMenu from '~/components/DropdownMenu.vue' import DropdownMenu from '~/components/DropdownMenu.vue'
import SearchDropdown from '~/components/SearchDropdown.vue' import SearchDropdown from '~/components/SearchDropdown.vue'
import { useIsMobile } from '~/utils/screen' import { useIsMobile } from '~/utils/screen'
import { useRouter } from 'vue-router'
import { ClientOnly } from '#components' import { ClientOnly } from '#components'
export default { export default {
@@ -66,18 +67,14 @@ export default {
default: true, default: true,
}, },
}, },
data() {
return {
avatar: '',
showSearch: false,
searchDropdown: null,
}
},
setup() { setup() {
const isLogin = computed(() => authState.loggedIn) const isLogin = computed(() => authState.loggedIn)
const isMobile = useIsMobile() const isMobile = useIsMobile()
const unreadCount = computed(() => notificationState.unreadCount) const unreadCount = computed(() => notificationState.unreadCount)
const router = useRouter() const router = useRouter()
const avatar = ref('')
const showSearch = ref(false)
const searchDropdown = ref(null)
const goToHome = () => { const goToHome = () => {
router.push('/').then(() => { router.push('/').then(() => {
@@ -144,6 +141,8 @@ export default {
goToProfile, goToProfile,
goToSignup, goToSignup,
goToLogout, goToLogout,
showSearch,
searchDropdown,
} }
}, },