-
+ {{ tag.title }}
+
+
route.path,
@@ -63,6 +51,15 @@ watch(
{ immediate: true }
)
+const scrollX = ref(null)
+watch(
+ () => tagsStore.tags,
+ async (newVal, oldVal) => {
+ await nextTick()
+ scrollX.value?.refreshIsOverflow(newVal.length > oldVal.length)
+ }
+)
+
const handleTagClick = (path) => {
tagsStore.setActiveTag(path)
router.push(path)
@@ -86,74 +83,27 @@ async function handleContextMenu(e, tagItem) {
await nextTick()
showContextMenu()
}
-
-function handleMouseWheel(e) {
- let { wheelDelta } = e
- const tagsWrapperWidth = tagsWrapper.value.offsetWidth
- const tagsContentWidth = tagsContent.value.offsetWidth
- /**
- * @wheelDelta 平行滚动的值 >0: 右移 <0: 左移
- * @translateX 内容translateX的值
- * @tagsWrapperWidth 容器的宽度
- * @tagsContentWidth 内容的宽度
- */
-
- // 向右移动时时,如果无偏移或者向左偏移,则不处理
- if (wheelDelta > 0 && translateX.value >= 0) {
- return
- }
-
- // 向左移动时,如果内容的宽度小于向左偏移的宽度+容器的宽度,则不处理
- if (wheelDelta < 0 && tagsWrapperWidth > tagsContentWidth + translateX.value) {
- return
- }
-
- if (wheelDelta > 0 && wheelDelta + translateX.value > 0) {
- wheelDelta = -translateX.value
- }
-
- if (wheelDelta < 0 && -wheelDelta > tagsWrapperWidth - (tagsContentWidth + translateX.value)) {
- wheelDelta = tagsWrapperWidth - (tagsContentWidth + translateX.value)
- }
-
- translateX.value += wheelDelta
-}
diff --git a/src/styles/index.scss b/src/styles/index.scss
index 5b5754b..f10f5cd 100644
--- a/src/styles/index.scss
+++ b/src/styles/index.scss
@@ -31,7 +31,7 @@ body {
.cur-scroll {
&::-webkit-scrollbar{
width:8px;
- height:8px;
+ height:6px;
}
&::-webkit-scrollbar-thumb{
background-color: transparent;