|
|
@@ -1,9 +1,6 @@
|
|
|
<template>
|
|
|
<div class="tag-wp">
|
|
|
<div class="tag-list">
|
|
|
- <!-- <lay-tag class="tag-item" maxWidth="100px" size="lg">
|
|
|
- <lay-icon type="layui-icon-home" @click="jumpPage(homePagePath.path)" />
|
|
|
- </lay-tag> -->
|
|
|
<lay-tag class="tag-item" v-for="item in menuList" :closable="menuList.length > 1" maxWidth="100px" size="lg" @click="jumpPage(item)" @close="handleClose(item)">
|
|
|
<span :class="{ lineheight: route.path == item.path }">{{ item.name }}</span>
|
|
|
</lay-tag>
|
|
|
@@ -12,9 +9,11 @@
|
|
|
</template>
|
|
|
|
|
|
<script lang="ts" setup>
|
|
|
-import { ref, watchEffect } from "vue";
|
|
|
+import { ref, watchEffect, defineEmits } from "vue";
|
|
|
import { useRouter, useRoute } from "vue-router";
|
|
|
|
|
|
+const emit = defineEmits(["close"]);
|
|
|
+
|
|
|
const router = useRouter();
|
|
|
const route = useRoute();
|
|
|
|
|
|
@@ -23,11 +22,12 @@ interface MenuList {
|
|
|
name: string;
|
|
|
path: string;
|
|
|
query: any;
|
|
|
+ templateName: string;
|
|
|
}
|
|
|
const menuList = ref<Array<MenuList>>([]);
|
|
|
|
|
|
watchEffect(() => {
|
|
|
- let routeInfo = { name: route.meta.title, path: route.path, query: route.query };
|
|
|
+ let routeInfo = { name: route.meta.title, path: route.path, query: route.query, templateName: route.name };
|
|
|
window.sessionStorage.setItem("_4L_S_MENU_PATH", JSON.stringify(routeInfo));
|
|
|
let routeList = window.sessionStorage.getItem("_4L_TAG_LIST");
|
|
|
let tagList = routeList ? JSON.parse(routeList) : [];
|
|
|
@@ -43,7 +43,7 @@ watchEffect(() => {
|
|
|
|
|
|
const handleClose = (menu: any) => {
|
|
|
if (menu.path == route.path) {
|
|
|
- let tagList = JSON.parse(window.sessionStorage.getItem("_4L_TAG_LIST") || "{}");
|
|
|
+ let tagList = JSON.parse(window.sessionStorage.getItem("_4L_TAG_LIST") || "[]");
|
|
|
const index = tagList.findIndex((item: any) => item.path === menu.path);
|
|
|
if (index == tagList.length - 1) {
|
|
|
let menu = menuList.value[index - 1];
|
|
|
@@ -57,6 +57,7 @@ const handleClose = (menu: any) => {
|
|
|
}
|
|
|
menuList.value = menuList.value.filter((item: any) => item.path != menu.path);
|
|
|
window.sessionStorage.setItem("_4L_TAG_LIST", JSON.stringify(menuList.value));
|
|
|
+ emit("close", menu.templateName);
|
|
|
};
|
|
|
|
|
|
const jumpPage = (menu: any) => {
|