From 407b81086e284ddae83c4f124988c7147aa6ee56 Mon Sep 17 00:00:00 2001 From: ZhangXianQiang <1135831638@qq.com> Date: 星期四, 20 六月 2024 11:09:40 +0800 Subject: [PATCH] feat:工具栏跳转 --- src/views/home/components/user-panel/index.vue | 31 +++++++++++++++++++------------ 1 files changed, 19 insertions(+), 12 deletions(-) diff --git a/src/views/home/components/user-panel/index.vue b/src/views/home/components/user-panel/index.vue index 03c2294..228192f 100644 --- a/src/views/home/components/user-panel/index.vue +++ b/src/views/home/components/user-panel/index.vue @@ -20,7 +20,7 @@ </div> <div class="tool-container grid grid-cols-3 gap-10"> - <div class="tool-item text-center cursor-pointer" v-for="item in toolList"> + <div class="tool-item text-center cursor-pointer" v-for="item in toolList" @click="toolClick(item)"> <div class="tool-icon mb-1"> <img :src="item.iconPath" class="width-img" alt=""> </div> @@ -38,27 +38,28 @@ <script setup> import { ref, computed } from 'vue'; import randomColor from '@/utils/randomColor.js'; +import { useRouter } from 'vue-router'; + +const router = useRouter(); const toolList = ref([ { id: 1, - title: '璧勬簮鍏变韩', - iconPath: new URL('@/assets/icons/icon1.png', import.meta.url).href + title: '鍦ㄧ嚎鍩硅', + iconPath: new URL('@/assets/icons/icon1.png', import.meta.url).href, + path: '/train' }, { id: 2, - title: '鎴戠殑璇剧▼', - iconPath: new URL('@/assets/icons/icon2.png', import.meta.url).href + title: '鎴戠殑鑰冭瘯', + iconPath: new URL('@/assets/icons/icon2.png', import.meta.url).href, + path: '/exam-list' }, { id: 3, - title: '鎴戠殑璇剧▼', - iconPath: new URL('@/assets/icons/icon2.png', import.meta.url).href - }, - { - id: 4, - title: '鎴戠殑璇剧▼', - iconPath: new URL('@/assets/icons/icon2.png', import.meta.url).href + title: '鎴戠殑鎴愮哗', + iconPath: new URL('@/assets/icons/icon2.png', import.meta.url).href, + path: '/grade-list' }, ]); @@ -67,6 +68,12 @@ return randomColor(); }); +const toolClick = (item) => { + if (item.path) { + router.push(item.path); + } +} + </script> <style lang="scss" scoped> -- Gitblit v1.8.0