From bb5520a7d1fecac5351d8d679d3b72408bfd1cc1 Mon Sep 17 00:00:00 2001 From: RuoYi Date: Sat, 30 May 2020 14:54:58 +0800 Subject: [PATCH] =?UTF-8?q?=E5=BD=93tags-view=E6=BB=9A=E5=8A=A8=E5=85=B3?= =?UTF-8?q?=E9=97=AD=E5=8F=B3=E9=94=AE=E8=8F=9C=E5=8D=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ruoyi-ui/src/assets/styles/element-ui.scss | 2 +- .../layout/components/TagsView/ScrollPane.vue | 9 + .../src/layout/components/TagsView/index.vue | 557 +++++++++--------- 3 files changed, 281 insertions(+), 287 deletions(-) diff --git a/ruoyi-ui/src/assets/styles/element-ui.scss b/ruoyi-ui/src/assets/styles/element-ui.scss index 558eea4..cd94103 100644 --- a/ruoyi-ui/src/assets/styles/element-ui.scss +++ b/ruoyi-ui/src/assets/styles/element-ui.scss @@ -31,7 +31,7 @@ .fixed-width { .el-button--mini { padding: 7px 10px; - width: 60px; + min-width: 60px; } } diff --git a/ruoyi-ui/src/layout/components/TagsView/ScrollPane.vue b/ruoyi-ui/src/layout/components/TagsView/ScrollPane.vue index 8be9c01..dd4b77f 100644 --- a/ruoyi-ui/src/layout/components/TagsView/ScrollPane.vue +++ b/ruoyi-ui/src/layout/components/TagsView/ScrollPane.vue @@ -19,12 +19,21 @@ export default { return this.$refs.scrollContainer.$refs.wrap } }, + mounted() { + this.scrollWrapper.addEventListener('scroll', this.emitScroll, true) + }, + beforeDestroy() { + this.scrollWrapper.removeEventListener('scroll', this.emitScroll) + }, methods: { handleScroll(e) { const eventDelta = e.wheelDelta || -e.deltaY * 40 const $scrollWrapper = this.scrollWrapper $scrollWrapper.scrollLeft = $scrollWrapper.scrollLeft + eventDelta / 4 }, + emitScroll() { + this.$emit('scroll') + }, moveToTarget(currentTag) { const $container = this.$refs.scrollContainer.$el const $containerWidth = $container.offsetWidth diff --git a/ruoyi-ui/src/layout/components/TagsView/index.vue b/ruoyi-ui/src/layout/components/TagsView/index.vue index 5432318..529090a 100644 --- a/ruoyi-ui/src/layout/components/TagsView/index.vue +++ b/ruoyi-ui/src/layout/components/TagsView/index.vue @@ -1,318 +1,303 @@