1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
| <script setup>
| import { ref } from "vue";
| import { useRouter } from "vue-router";
| import { useMenuStore } from "@/stores/menu.js";
| import { storeToRefs } from "pinia";
| const menuStroe = useMenuStore();
| const { isOpen } = storeToRefs(menuStroe);
|
| const router = useRouter();
|
| const props = defineProps({
| data: {
| type: Object,
| required: true,
| },
| acTabs: {
| type: String,
| required: true,
| },
| });
|
| function go() {
| let path = props.data.path;
| if (!path) return false;
| isOpen.value = false;
| router.push(path);
| }
| </script>
|
| <template>
| <div :class="['menu-leaf', { active: acTabs == data.id }]" @click="go">
| <div v-if="data.icon" :class="['ico', data.icon]"></div>
| {{ data.name }}
| </div>
| </template>
|
| <style scoped lang="less">
| .menu-leaf {
| // text-indent: 2em;
| color: #01fdfe;
| cursor: pointer;
| display: flex;
| align-items: center;
| &.active {
| background: #0ff;
| color: #000;
| }
| &:hover {
| background: #29aaaa;
| }
| .ico {
| width: 30px;
| height: 30px;
| margin-right: 0.4em;
| }
| }
| </style>
|
|