完善后台布局
This commit is contained in:
@@ -1,12 +1,11 @@
|
||||
<template>
|
||||
<div class="userbar">
|
||||
<!-- 菜单搜索 -->
|
||||
<a-input-search v-model:value="searchKeyword" :placeholder="$t('common.searchMenu')" enter-button
|
||||
@search="handleSearch" class="search-input" allow-clear>
|
||||
<template #prefix>
|
||||
<a-tooltip :title="$t('common.search')">
|
||||
<a-button type="text" @click="showSearch" class="action-btn">
|
||||
<SearchOutlined />
|
||||
</template>
|
||||
</a-input-search>
|
||||
</a-button>
|
||||
</a-tooltip>
|
||||
|
||||
<!-- 消息通知 -->
|
||||
<a-dropdown :trigger="['click']" placement="bottomRight">
|
||||
@@ -112,7 +111,7 @@
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref, computed, onMounted, onUnmounted } from 'vue'
|
||||
import { ref, computed, onMounted, onUnmounted, defineOptions } from 'vue'
|
||||
import { useRouter } from 'vue-router'
|
||||
import { message, Modal } from 'ant-design-vue'
|
||||
import { useUserStore } from '@/stores/modules/user'
|
||||
@@ -131,13 +130,17 @@ import {
|
||||
} from '@ant-design/icons-vue'
|
||||
import { useI18n } from 'vue-i18n'
|
||||
|
||||
// 定义组件名称(多词命名)
|
||||
defineOptions({
|
||||
name: 'UserBar'
|
||||
})
|
||||
|
||||
const { t } = useI18n()
|
||||
const router = useRouter()
|
||||
const userStore = useUserStore()
|
||||
const i18nStore = useI18nStore()
|
||||
|
||||
const isFullscreen = ref(false)
|
||||
const searchKeyword = ref('')
|
||||
|
||||
// 消息数据
|
||||
const messages = ref([
|
||||
@@ -182,15 +185,9 @@ onUnmounted(() => {
|
||||
document.removeEventListener('fullscreenchange', handleFullscreenChange)
|
||||
})
|
||||
|
||||
// 菜单搜索
|
||||
const handleSearch = (value) => {
|
||||
if (!value.trim()) {
|
||||
message.warning(t('common.searchEmpty'))
|
||||
return
|
||||
}
|
||||
// 这里可以实现实际的搜索逻辑,比如跳转到搜索页面或显示搜索结果
|
||||
message.info(t('common.searching') + value)
|
||||
searchKeyword.value = ''
|
||||
// 显示搜索功能
|
||||
const showSearch = () => {
|
||||
message.info('搜索功能开发中')
|
||||
}
|
||||
|
||||
// 清除消息
|
||||
@@ -244,7 +241,7 @@ const handleLogout = () => {
|
||||
await userStore.logout()
|
||||
message.success(t('common.logoutSuccess'))
|
||||
router.push('/login')
|
||||
} catch (error) {
|
||||
} catch {
|
||||
message.error(t('common.logoutFailed'))
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user