|
|
@@ -4,7 +4,7 @@
|
|
|
<!-- <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.path)" @close="handleClose(item)">
|
|
|
+ <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>
|
|
|
</div>
|
|
|
@@ -27,12 +27,16 @@ interface MenuList {
|
|
|
const menuList = ref<Array<MenuList>>([]);
|
|
|
|
|
|
watchEffect(() => {
|
|
|
- let routeInfo = { name: route.meta.title, path: route.fullPath, query: route.query };
|
|
|
+ let routeInfo = { name: route.meta.title, path: route.path, query: route.query };
|
|
|
window.sessionStorage.setItem("_4L_S_MENU_PATH", JSON.stringify(routeInfo));
|
|
|
let routeList = window.sessionStorage.getItem("_4L_TAG_LIST");
|
|
|
let tagList = routeList ? JSON.parse(routeList) : [];
|
|
|
- let isTag = tagList.find((item: any) => item.path == routeInfo.path);
|
|
|
+ let isTag = tagList.find((item: any, index: number) => {
|
|
|
+ if (item.path == routeInfo.path) tagList[index].query = routeInfo.query;
|
|
|
+ return item.path == routeInfo.path;
|
|
|
+ });
|
|
|
if (!isTag) tagList.push(routeInfo);
|
|
|
+
|
|
|
window.sessionStorage.setItem("_4L_TAG_LIST", JSON.stringify(tagList));
|
|
|
menuList.value = tagList;
|
|
|
});
|
|
|
@@ -55,8 +59,8 @@ const handleClose = (menu: any) => {
|
|
|
window.sessionStorage.setItem("_4L_TAG_LIST", JSON.stringify(menuList.value));
|
|
|
};
|
|
|
|
|
|
-const jumpPage = (path: string) => {
|
|
|
- router.push(path);
|
|
|
+const jumpPage = (menu: any) => {
|
|
|
+ router.push({ path: menu.path, query: menu.query });
|
|
|
};
|
|
|
</script>
|
|
|
<style lang="scss" scoped>
|