feat:新增 tagview 导航页
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
<template>
|
||||
<el-sub-menu :index="menu?.path" :class="subMenuClass" v-if="menu?.children?.length">
|
||||
<el-sub-menu :index="menu?.path" :class="subMenuClass" v-if="menu?.children?.length" :key="menu?.path">
|
||||
<template #title>
|
||||
<el-icon>
|
||||
<Icon :name="menu?.meta?.icon" v-if="menu?.meta?.icon" class="text-sm" />
|
||||
@@ -9,7 +9,7 @@
|
||||
<slot />
|
||||
</el-sub-menu>
|
||||
|
||||
<el-menu-item v-else class="ct-menu-item" :index="menu?.path" @click="isMiniScreen() && store.changeExpaned()">
|
||||
<el-menu-item v-else class="ct-menu-item" :index="menu?.path" @click="isMiniScreen() && store.changeExpaned()" :key="menu?.name">
|
||||
<el-icon>
|
||||
<Icon :name="menu?.meta?.icon" v-if="menu?.meta?.icon" class="text-sm" />
|
||||
</el-icon>
|
||||
|
@@ -14,8 +14,25 @@
|
||||
</template>
|
||||
<script lang="ts" setup>
|
||||
import { useAppStore } from '/admin/stores/modules/app'
|
||||
import { watch } from 'vue'
|
||||
import router from '/admin/router'
|
||||
import { useNavTabStore } from '/admin/stores/modules/tabs'
|
||||
|
||||
const appStore = useAppStore()
|
||||
const navTabStore = useNavTabStore()
|
||||
watch(() => router.currentRoute, (to, from) => {
|
||||
const tab: any = {
|
||||
name: to.value.name,
|
||||
fullPath: to.value.fullPath,
|
||||
path: to.value.path,
|
||||
is_active: true,
|
||||
meta: {
|
||||
title: to.value.meta.title,
|
||||
affix: false,
|
||||
}
|
||||
}
|
||||
navTabStore.addTabs(tab)
|
||||
}, {deep:true, immediate:true})
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
|
Reference in New Issue
Block a user