|
@@ -1,24 +1,9 @@
|
|
|
<template>
|
|
|
<div class="bottom-nav">
|
|
|
- <a :class="{ active: activeIndex === 0 }" @click.prevent="setActiveIndex(0)">
|
|
|
- <i class="fa-solid fa-house"></i>
|
|
|
- 首页
|
|
|
- </a>
|
|
|
- <a :class="{ active: activeIndex === 1 }" @click.prevent="setActiveIndex(1)">
|
|
|
- <i class="fa-solid fa-image"></i>
|
|
|
- 一张图
|
|
|
- </a>
|
|
|
- <a :class="{ active: activeIndex === 2 }" @click.prevent="setActiveIndex(2)">
|
|
|
- <i class="fa-solid fa-binoculars"></i>
|
|
|
- 督查
|
|
|
- </a>
|
|
|
- <a :class="{ active: activeIndex === 3 }" @click.prevent="setActiveIndex(3)">
|
|
|
- <i class="fa-solid fa-question"></i>
|
|
|
- 问题
|
|
|
- </a>
|
|
|
- <a :class="{ active: activeIndex === 4 }" @click.prevent="goToAboutPage">
|
|
|
- <i class="fa-solid fa-user"></i>
|
|
|
- 我的
|
|
|
+ <a v-for="item in menuList" :key="item.path" :class="{ 'active': activeIndex === item.path }"
|
|
|
+ @click.prevent="setActiveIndex(item.path)">
|
|
|
+ <ion-icon :icon="item.icon"></ion-icon>
|
|
|
+ {{ item.name }}
|
|
|
</a>
|
|
|
</div>
|
|
|
</template>
|
|
@@ -26,36 +11,34 @@
|
|
|
<script setup>
|
|
|
import { ref } from 'vue';
|
|
|
import { useRouter } from 'vue-router';
|
|
|
+import { homeOutline, navigateCircleOutline, shieldCheckmarkOutline, helpCircleOutline, personCircleOutline } from 'ionicons/icons';
|
|
|
+
|
|
|
+const menuList = [
|
|
|
+ { name: '首页', icon: homeOutline, path: '/index' },
|
|
|
+ { name: '一张图', icon: navigateCircleOutline, path: '/onepic' },
|
|
|
+ { name: '督查', icon: shieldCheckmarkOutline, path: '/inspect' },
|
|
|
+ { name: '问题', icon: helpCircleOutline, path: '/inspect' },
|
|
|
+ { name: '我的', icon: personCircleOutline, path: '/inspect' },
|
|
|
+]
|
|
|
|
|
|
// 定义当前激活的导航索引
|
|
|
-const activeIndex = ref(0);
|
|
|
+const activeIndex = ref('/index');
|
|
|
const router = useRouter();
|
|
|
|
|
|
// 定义设置激活索引的方法
|
|
|
-const setActiveIndex = (index) => {
|
|
|
- activeIndex.value = index;
|
|
|
- // 这里可以添加切换页面内容的逻辑
|
|
|
- // 例如根据点击的链接加载不同的内容
|
|
|
- if (index === 0) {
|
|
|
- router.push('/');
|
|
|
- }
|
|
|
-};
|
|
|
-
|
|
|
-// 定义跳转到关于页面的方法
|
|
|
-const goToAboutPage = () => {
|
|
|
- activeIndex.value = 4;
|
|
|
- router.push('/about');
|
|
|
+const setActiveIndex = (path) => {
|
|
|
+ activeIndex.value = path;
|
|
|
+ router.push(path);
|
|
|
};
|
|
|
</script>
|
|
|
-
|
|
|
-<style scoped>
|
|
|
+<style lang="scss" scoped>
|
|
|
.bottom-nav {
|
|
|
display: flex;
|
|
|
justify-content: space-around;
|
|
|
background-color: #333;
|
|
|
color: white;
|
|
|
- padding: 10px 0;
|
|
|
- position: fixed;
|
|
|
+ // padding: 10px 0;
|
|
|
+ position: fixed;
|
|
|
bottom: 0;
|
|
|
left: 0;
|
|
|
right: 0;
|
|
@@ -68,14 +51,20 @@ const goToAboutPage = () => {
|
|
|
display: flex;
|
|
|
flex-direction: column;
|
|
|
align-items: center;
|
|
|
+ font-size: .8rem;
|
|
|
}
|
|
|
|
|
|
-.bottom-nav a i {
|
|
|
- font-size: 24px;
|
|
|
- margin-bottom: 5px;
|
|
|
+.bottom-nav a.active {
|
|
|
+ color: #007BFF;
|
|
|
+}
|
|
|
+</style>
|
|
|
+<style>
|
|
|
+.bottom-nav ion-icon {
|
|
|
+ font-size: 1.5rem;
|
|
|
+ color: #fff;
|
|
|
}
|
|
|
|
|
|
-.bottom-nav a.active {
|
|
|
+.bottom-nav .active ion-icon {
|
|
|
color: #007BFF;
|
|
|
}
|
|
|
</style>
|