Fix: 修正部分加载Bug & 调整页面样式
This commit is contained in:
@ -8,17 +8,17 @@
|
||||
|
||||
|
||||
<!-- 导航菜单 -->
|
||||
<el-menu default-active="productions" class="header-menu" mode="horizontal" :ellipsis="false" router>
|
||||
<el-menu-item :index="$localePath('/productions')">
|
||||
<el-menu :default-active="activeName" class="header-menu" mode="horizontal" :ellipsis="false" :persistent="false" router>
|
||||
<el-menu-item index="productions" :route="$localePath('/productions')">
|
||||
<span class="title">{{ $t('navigation.productions') }}</span>
|
||||
</el-menu-item>
|
||||
<el-menu-item :index="$localePath('/solutions')">
|
||||
<el-menu-item index="solutions" :route="$localePath('/solutions')">
|
||||
<span class="title">{{ $t('navigation.solutions') }}</span>
|
||||
</el-menu-item>
|
||||
<el-menu-item :index="$localePath('/support')">
|
||||
<el-menu-item index="support" :route="$localePath('/support')">
|
||||
<span class="title">{{ $t('navigation.support') }}</span>
|
||||
</el-menu-item>
|
||||
<el-menu-item :index="$localePath('/about')">
|
||||
<el-menu-item index="about" :route="$localePath('/about')">
|
||||
<span class="title">{{ $t('navigation.about-us') }}</span>
|
||||
</el-menu-item>
|
||||
</el-menu>
|
||||
@ -46,10 +46,14 @@ v-model="searchQuery" class="search-input" :placeholder="$t('search-placeholder'
|
||||
<script setup lang="ts">
|
||||
import { Search } from '@element-plus/icons-vue';
|
||||
|
||||
const router = useRouter();
|
||||
|
||||
const { setLocale } = useI18n();
|
||||
|
||||
const searchQuery = ref('')
|
||||
|
||||
const activeName = ref('')
|
||||
|
||||
const handleSearch = () => {
|
||||
if (searchQuery.value.trim()) {
|
||||
// 这里可以添加搜索逻辑,例如导航到搜索结果页面
|
||||
@ -58,6 +62,22 @@ const handleSearch = () => {
|
||||
// router.push({ path: '/search', query: { q: searchQuery.value } });
|
||||
}
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
const path = router.currentRoute.value.path;
|
||||
if (path.startsWith('/productions')) {
|
||||
activeName.value = 'productions';
|
||||
} else if (path.startsWith('/solutions')) {
|
||||
activeName.value = 'solutions';
|
||||
} else if (path.startsWith('/support')) {
|
||||
activeName.value = 'support';
|
||||
} else if (path.startsWith('/about')) {
|
||||
activeName.value = 'about';
|
||||
} else {
|
||||
activeName.value = '';
|
||||
}
|
||||
console.log('Current path:', path, 'Active menu:', activeName.value);
|
||||
})
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
@ -66,7 +86,7 @@ const handleSearch = () => {
|
||||
padding: 0 10px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
border-bottom: 1px solid #e0e0e0;
|
||||
/* border-bottom: 1px solid #e0e0e0; */
|
||||
}
|
||||
|
||||
.logo-section {
|
||||
@ -82,7 +102,7 @@ const handleSearch = () => {
|
||||
}
|
||||
|
||||
.website-logo {
|
||||
height: 64px;
|
||||
height: 80px;
|
||||
width: auto;
|
||||
}
|
||||
|
||||
@ -93,7 +113,16 @@ const handleSearch = () => {
|
||||
}
|
||||
|
||||
.header-menu .el-menu-item {
|
||||
border-bottom: none !important;
|
||||
font-size: 16px;
|
||||
background-color: transparent !important;
|
||||
}
|
||||
|
||||
.header-menu .el-menu-item:active {
|
||||
border-bottom: 2px solid var(--el-color-primary);
|
||||
}
|
||||
|
||||
.header-menu .el-menu-item:hover {
|
||||
border-bottom: 2px solid var(--el-color-primary);
|
||||
}
|
||||
|
||||
.header-actions {
|
||||
|
||||
Reference in New Issue
Block a user