|
@@ -2,8 +2,10 @@
|
|
|
<div>
|
|
|
<div class="bigBox">
|
|
|
<template v-for="(item, index) in menuList">
|
|
|
- <div class="menuBox">
|
|
|
- <img :src="item.noChoose" alt="">
|
|
|
+ <div class="menuBox" @click="routeBoxClick(item)">
|
|
|
+ <img :style="{ 'background': item.isChosen ? 'linear-gradient(138deg, #dbdbdb 0%, #cccecf 100%)' : 'none' }"
|
|
|
+ :src="item.isChosen ? item.isChoose : item.noChoose" class="rImg" alt="">
|
|
|
+ <p class="rp">{{ item.name }}</p>
|
|
|
</div>
|
|
|
</template>
|
|
|
</div>
|
|
@@ -12,41 +14,101 @@
|
|
|
|
|
|
<script>
|
|
|
import { ref, onMounted } from 'vue'
|
|
|
+import { useRouter } from 'vue-router'
|
|
|
import allImg from "../../../src/utils/allImg.js"
|
|
|
export default {
|
|
|
setup() {
|
|
|
let menuList = ref([
|
|
|
{
|
|
|
name: "检测任务",
|
|
|
- route: "/checkMession",
|
|
|
+ route: "/home/mission",
|
|
|
id: 1,
|
|
|
noChoose: allImg.searchGray,
|
|
|
- isChoose: allImg.searchBlue
|
|
|
+ isChoose: allImg.searchBlue,
|
|
|
+ isChosen: true
|
|
|
},
|
|
|
{
|
|
|
name: "报告结果",
|
|
|
- route: "/check",
|
|
|
- id: 2
|
|
|
+ route: "/home/report",
|
|
|
+ id: 2,
|
|
|
+ noChoose: allImg.reportGray,
|
|
|
+ isChoose: allImg.reportBlue,
|
|
|
+ isChosen: false
|
|
|
},
|
|
|
{
|
|
|
name: "基础设置",
|
|
|
- route: "/setting",
|
|
|
- id: 3
|
|
|
+ route: "/home/setting",
|
|
|
+ id: 3,
|
|
|
+ noChoose: allImg.settingGray,
|
|
|
+ isChoose: allImg.settingBlue,
|
|
|
+ isChosen: false
|
|
|
},
|
|
|
{
|
|
|
name: "系统管理",
|
|
|
- route: "/system",
|
|
|
- id: 4
|
|
|
+ route: "/home/system",
|
|
|
+ id: 4,
|
|
|
+ noChoose: allImg.systemGray,
|
|
|
+ isChoose: allImg.systemBlue,
|
|
|
+ isChosen: false
|
|
|
},
|
|
|
- ])
|
|
|
+ ])//路由菜单
|
|
|
+ let router = useRouter()//初始化路由实例
|
|
|
+ // 路由盒子
|
|
|
+ function routeBoxClick(row) {
|
|
|
+ // 设置所有菜单项的 isChosen 为 false
|
|
|
+ menuList.value.forEach((item) => {
|
|
|
+ item.isChosen = false;
|
|
|
+ });
|
|
|
+ // 设置当前点击的菜单项为 isChosen
|
|
|
+ row.isChosen = true;
|
|
|
+ router.push(row.route)
|
|
|
+ }
|
|
|
onMounted(() => {
|
|
|
|
|
|
})
|
|
|
return {
|
|
|
- menuList,
|
|
|
+ menuList,//路由菜单
|
|
|
+ routeBoxClick,//路由盒子点击事件
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
</script>
|
|
|
|
|
|
-<style lang="scss" scoped></style>
|
|
|
+<style scoped>
|
|
|
+p {
|
|
|
+ margin: 0;
|
|
|
+ padding: 0;
|
|
|
+}
|
|
|
+
|
|
|
+.bigBox {
|
|
|
+ width: 95px;
|
|
|
+ height: 605px;
|
|
|
+ margin: 0 auto;
|
|
|
+ margin-top: 25px;
|
|
|
+ overflow-y: auto;
|
|
|
+}
|
|
|
+
|
|
|
+.menuBox {
|
|
|
+ width: 80px;
|
|
|
+ height: 60px;
|
|
|
+ text-align: center;
|
|
|
+ line-height: 25px;
|
|
|
+ cursor: pointer;
|
|
|
+ margin-bottom: 10px;
|
|
|
+}
|
|
|
+
|
|
|
+.rImg {
|
|
|
+ display: block;
|
|
|
+ width: 28px;
|
|
|
+ height: 28px;
|
|
|
+ border-radius: 5px;
|
|
|
+ margin: 0 auto;
|
|
|
+ /* border-image: linear-gradient(171deg, rgba(215, 237, 255, 1), rgba(158, 210, 253, 1)) 0 0; */
|
|
|
+}
|
|
|
+
|
|
|
+.rp {
|
|
|
+ width: 80px;
|
|
|
+ height: 30px;
|
|
|
+ font-size: 14px;
|
|
|
+}
|
|
|
+</style>
|