完成适配移动端
This commit is contained in:
@@ -1,26 +1,7 @@
|
||||
<script setup lang="ts">
|
||||
import {navigateTo} from "#imports";
|
||||
|
||||
const navigations = useMenu();
|
||||
import {useMenu} from "~/composables/configState";
|
||||
const handleSelect = (index: any,keyPath: string[]) => {
|
||||
const split = index.split('-');
|
||||
if(split.length == 1){
|
||||
const item = navigations.value[index];
|
||||
navigateTo(item)
|
||||
}
|
||||
if(split.length == 2){
|
||||
const item = navigations.value[split[0]];
|
||||
if(item.children){
|
||||
const child = item.children[split[1]];
|
||||
navigateTo(child.path)
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<!-- PC版菜单 -->
|
||||
<el-menu
|
||||
class="hidden-sm-and-down"
|
||||
mode="horizontal"
|
||||
style="background-color: transparent;"
|
||||
active-text-color="#1b850c"
|
||||
@@ -54,7 +35,27 @@ const handleSelect = (index: any,keyPath: string[]) => {
|
||||
</template>
|
||||
</el-menu>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
import {navigateTo} from "#imports";
|
||||
import {useMenu} from "~/composables/configState";
|
||||
|
||||
const navigations = useMenu();
|
||||
|
||||
const handleSelect = (index: any,keyPath: string[]) => {
|
||||
const split = index.split('-');
|
||||
if(split.length == 1){
|
||||
const item = navigations.value[index];
|
||||
navigateTo(item)
|
||||
}
|
||||
if(split.length == 2){
|
||||
const item = navigations.value[split[0]];
|
||||
if(item.children){
|
||||
const child = item.children[split[1]];
|
||||
navigateTo(child.path)
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<style scoped lang="scss">
|
||||
.el-menu--horizontal > .el-menu-item:nth-child(1) {
|
||||
margin-right: auto;
|
||||
|
||||
Reference in New Issue
Block a user