From b89ed80f20f2e07729a68f2c6ed2ca5134332a17 Mon Sep 17 00:00:00 2001 From: wujingjing <gersonwu@qq.com> Date: 星期五, 28 六月 2024 11:17:59 +0800 Subject: [PATCH] ywicon --- src/layout/component/sidebar/waterLeftAside/asideTitle.vue | 25 ++++++++++++++----------- 1 files changed, 14 insertions(+), 11 deletions(-) diff --git a/src/layout/component/sidebar/waterLeftAside/asideTitle.vue b/src/layout/component/sidebar/waterLeftAside/asideTitle.vue index 0d2ab7b..8dde9bb 100644 --- a/src/layout/component/sidebar/waterLeftAside/asideTitle.vue +++ b/src/layout/component/sidebar/waterLeftAside/asideTitle.vue @@ -5,8 +5,8 @@ class="flex items-center set-li" v-for="(item, index) in state.asideTitleList" :key="index" - @click="handleClick(item.id)" - :class="{ 'set-li-active': state.currentActive === item.id }" + @click="handleClick(item)" + :class="{ 'set-li-active': item.routerName === currentRoute.name }" > <img :src="item.icon" alt="" class="pl-2.5 pr-2.5 w-4 h-4" style="box-sizing: content-box" /> <span class="font-medium text-sm text-white tracking-wide">{{ item.title }}</span> @@ -30,17 +30,21 @@ <script setup lang="ts"> import { reactive } from 'vue'; import { gotoRoute } from '/@/utils/route'; +import router from '/@/router'; let state = reactive({ asideTitleList: [ { id: 1, icon: '/static/images/wave/AsideIcon.png', title: '搴旂敤鍦烘櫙', + routerName:'Scenario', }, { id: 2, icon: '/static/images/wave/AsideIcon.png', title: '甯姪涓績', + // routerName:'Scenario', + }, { id: 3, @@ -51,19 +55,18 @@ id: 4, icon: '/static/images/wave/AsideIcon.png', title: '鍏充簬姘村姟AI', + routerName:'AboutUs', + }, ], - currentActive: 0, }); -const handleClick = (id) => { - state.currentActive = id; - if (id == 1) { - gotoRoute({ name: 'Scenario' }); - } - if (id == 4) { - gotoRoute({ name: 'AboutUs' }); - } +const handleClick = (item) => { + gotoRoute({name:item.routerName}); + }; + + +const currentRoute = router.currentRoute; </script> <style scoped lang="scss"> .aisde-title { -- Gitblit v1.9.3