V0.1.2.20250718

———————————————
1.路由重定向
2.Home页面头部完成
———————————————
This commit is contained in:
Childish-Ghost 2025-07-18 23:48:55 +08:00
parent 1614b560ff
commit aca3aa8f6b

View File

@ -2,9 +2,11 @@
import "@/assets/ordinary/Home.css"
import {ref} from 'vue'
import { UserFilled } from '@element-plus/icons-vue'
const activeIndex = ref('1')
const handleSelect = (key: string, keyPath: string[]) => {
console.log(key, keyPath)
import {useRouter} from "vue-router";
const router = useRouter()
const activeIndex = ref(router.currentRoute.value.path) //
const handleSelect = (path: string) => {
router.push(path)
}
</script>
@ -18,12 +20,13 @@ const handleSelect = (key: string, keyPath: string[]) => {
mode="horizontal"
:ellipsis="false"
@select="handleSelect"
router
>
<!-- 左侧菜单项 -->
<el-menu-item index="1">首页</el-menu-item>
<el-menu-item index="2">图书</el-menu-item>
<el-menu-item index="3">期刊</el-menu-item>
<el-menu-item index="4">报纸</el-menu-item>
<el-menu-item index="/" :route="{ path: '/'}">首页</el-menu-item>
<el-menu-item index="/books" :route="{ path: '/books'}">图书</el-menu-item>
<el-menu-item index="/journals" :route="{ path: '/journals'}">期刊</el-menu-item>
<el-menu-item index="/newspapers" :route="{ path: '/newspapers'}">报纸</el-menu-item>
<!-- 弹性空间 -->
<div class="flex-grow"></div>
<!-- 头像-->
@ -35,6 +38,9 @@ const handleSelect = (key: string, keyPath: string[]) => {
<div class="h-6"/>
</div>
</header>
<div>
</div>
</template>
<style scoped>