mirror of
https://github.com/fugary/simple-element-plus-template.git
synced 2025-11-12 14:27:49 +00:00
图标工具
This commit is contained in:
@@ -1,5 +1,7 @@
|
|||||||
<script setup>
|
<script setup>
|
||||||
import { computed } from 'vue'
|
import { computed } from 'vue'
|
||||||
|
import { useRouter } from 'vue-router'
|
||||||
|
const router = useRouter()
|
||||||
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
menuItem: {
|
menuItem: {
|
||||||
@@ -26,6 +28,16 @@ const menuCls = computed(() => {
|
|||||||
}
|
}
|
||||||
return menuItem.menuCls
|
return menuItem.menuCls
|
||||||
})
|
})
|
||||||
|
const dropdownClick = menuItem => {
|
||||||
|
if (menuItem.click) {
|
||||||
|
menuItem.click()
|
||||||
|
} else {
|
||||||
|
const route = menuItem.route || menuItem.index
|
||||||
|
if (route) {
|
||||||
|
router.push(route)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
@@ -67,6 +79,9 @@ const menuCls = computed(() => {
|
|||||||
v-else-if="isDropdown"
|
v-else-if="isDropdown"
|
||||||
:key="menuItem.index||index"
|
:key="menuItem.index||index"
|
||||||
:class="menuCls"
|
:class="menuCls"
|
||||||
|
:route="menuItem.route"
|
||||||
|
:index="menuItem.index"
|
||||||
|
@click="menuItem.click&&menuItem.click()"
|
||||||
>
|
>
|
||||||
<el-dropdown>
|
<el-dropdown>
|
||||||
<span class="el-dropdown-link">
|
<span class="el-dropdown-link">
|
||||||
@@ -82,7 +97,7 @@ const menuCls = computed(() => {
|
|||||||
<el-dropdown-item
|
<el-dropdown-item
|
||||||
v-for="(childMenu, childIdx) in menuItem.children"
|
v-for="(childMenu, childIdx) in menuItem.children"
|
||||||
:key="childMenu.index||childIdx"
|
:key="childMenu.index||childIdx"
|
||||||
@click="childMenu.click&&childMenu.click()"
|
@click="dropdownClick(childMenu)"
|
||||||
>
|
>
|
||||||
<common-icon
|
<common-icon
|
||||||
:size="childMenu.iconSize"
|
:size="childMenu.iconSize"
|
||||||
|
|||||||
Reference in New Issue
Block a user