|
|
@@ -1,9 +1,15 @@
|
|
|
<template>
|
|
|
<div class="tag-wp">
|
|
|
<div class="tag-list">
|
|
|
- <lay-tag class="tag-item" v-for="item in menuList" :closable="menuList.length > 1" maxWidth="120px" size="lg" @click="jumpPage(item)" @close="handleClose(item)">
|
|
|
- <span :class="{ lineheight: route.path == item.path }">{{ item.name }}</span>
|
|
|
- </lay-tag>
|
|
|
+ <lay-icon @click="prevSlide" type="layui-icon-left" />
|
|
|
+ <div class="tag-overflow-wp">
|
|
|
+ <div class="tag-overflow" ref="tagOverflowRef" :style="{ transform: 'translateX(' + currentWidth + 'px)' }">
|
|
|
+ <lay-tag class="tag-item" v-for="item in menuList" :closable="menuList.length > 1" maxWidth="120px" size="lg" @click="jumpPage(item)" @close="handleClose(item)">
|
|
|
+ <span :class="{ lineheight: route.path == item.path }">{{ item.name }}</span>
|
|
|
+ </lay-tag>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <lay-icon @click="nextSlide" type="layui-icon-right" />
|
|
|
</div>
|
|
|
<div class="tag-operator-wp">
|
|
|
<lay-dropdown class="operator-btn" placement="bottom-end" updateAtScroll>
|
|
|
@@ -29,6 +35,9 @@ const emit = defineEmits(["close", "closeOther", "closeAll"]);
|
|
|
const router = useRouter();
|
|
|
const route = useRoute();
|
|
|
|
|
|
+const tagOverflowRef = ref();
|
|
|
+const currentWidth = ref(0);
|
|
|
+
|
|
|
// const homePagePath = reactive(JSON.parse(window.sessionStorage.getItem("_4L_MENU_PATH")!));
|
|
|
interface MenuList {
|
|
|
name: string;
|
|
|
@@ -91,6 +100,16 @@ const handleCloseAll = () => {
|
|
|
const jumpPage = (menu: any) => {
|
|
|
router.push({ path: menu.path, query: menu.query });
|
|
|
};
|
|
|
+
|
|
|
+const nextSlide = () => {
|
|
|
+ let width = currentWidth.value - tagOverflowRef.value.offsetWidth;
|
|
|
+ currentWidth.value = width + tagOverflowRef.value.offsetWidth <= -tagOverflowRef.value.scrollWidth + tagOverflowRef.value.offsetWidth ? width + tagOverflowRef.value.offsetWidth : width;
|
|
|
+};
|
|
|
+
|
|
|
+const prevSlide = () => {
|
|
|
+ const width = currentWidth.value + tagOverflowRef.value.offsetWidth;
|
|
|
+ currentWidth.value = width >= 0 ? 0 : width;
|
|
|
+};
|
|
|
</script>
|
|
|
<style lang="scss" scoped>
|
|
|
.tag-wp {
|
|
|
@@ -106,14 +125,23 @@ const jumpPage = (menu: any) => {
|
|
|
flex-direction: row;
|
|
|
align-items: center;
|
|
|
padding: 10px;
|
|
|
- .tag-item {
|
|
|
- cursor: pointer;
|
|
|
- margin-right: 10px;
|
|
|
- .lineheight {
|
|
|
- color: var(--color-theme);
|
|
|
- }
|
|
|
- .layui-icon {
|
|
|
- font-size: 16px;
|
|
|
+ .tag-overflow-wp {
|
|
|
+ overflow: hidden;
|
|
|
+ margin: 0 10px;
|
|
|
+ flex: 1;
|
|
|
+ .tag-overflow {
|
|
|
+ display: flex;
|
|
|
+ transition: transform 0.3s ease;
|
|
|
+ .tag-item {
|
|
|
+ cursor: pointer;
|
|
|
+ margin-right: 10px;
|
|
|
+ .lineheight {
|
|
|
+ color: var(--color-theme);
|
|
|
+ }
|
|
|
+ .layui-icon {
|
|
|
+ font-size: 16px;
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
@@ -121,7 +149,7 @@ const jumpPage = (menu: any) => {
|
|
|
width: 30px;
|
|
|
.operator-btn {
|
|
|
padding: 2px;
|
|
|
- border: 1px solid rgba(0, 0, 0, 0.5);
|
|
|
+ border: 1px solid black;
|
|
|
}
|
|
|
}
|
|
|
}
|