From ca310d6c02d670a99e4547a1b4f128c9e16c8710 Mon Sep 17 00:00:00 2001 From: ZF sun <34314687@qq.com> Date: Mon, 27 Oct 2025 17:43:43 +0800 Subject: [PATCH] =?UTF-8?q?refactor(ui):=20=E9=A6=96=E9=A1=B5=E6=B7=BB?= =?UTF-8?q?=E5=8A=A0=E5=9B=9E=E5=88=B0=E6=9C=80=E9=A1=B6=E7=AB=AF=E6=8C=89?= =?UTF-8?q?=E9=92=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- common/js/scroll-view.js | 5 +++-- pages/index/index.vue | 18 +++++++++++++++--- 2 files changed, 18 insertions(+), 5 deletions(-) diff --git a/common/js/scroll-view.js b/common/js/scroll-view.js index 431e278..594e03e 100644 --- a/common/js/scroll-view.js +++ b/common/js/scroll-view.js @@ -3,7 +3,8 @@ export default { return { showTop: false, scrollTop: 0, - oldLocation: 0 + oldLocation: 0, + minScrollTop: 400, // 内置最小scrollTop值设置, 方便组件自身差异化设置 } }, methods: { @@ -19,7 +20,7 @@ export default { }, onPageScroll(e) { this.oldLocation = e.scrollTop; - if (e.scrollTop > 400) { + if (e.scrollTop > this.minScrollTop) { this.showTop = true; } else { this.showTop = false; diff --git a/pages/index/index.vue b/pages/index/index.vue index 88f5589..918cb69 100644 --- a/pages/index/index.vue +++ b/pages/index/index.vue @@ -126,7 +126,7 @@ - + @@ -135,13 +135,22 @@ import nsNavbar from '@/components/ns-navbar/ns-navbar.vue'; import diyJs from '@/common/js/diy.js'; import indexJs from './public/js/index.js'; + import toTop from '@/components/toTop/toTop.vue'; + import scroll from '@/common/js/scroll-view.js'; + export default { + data() { + return { + minScrollTop: 200, + } + }, components: { uniPopup, - nsNavbar + nsNavbar, + toTop }, - mixins: [diyJs, indexJs] + mixins: [diyJs, indexJs, scroll] }; @@ -190,6 +199,9 @@ font-size: 60rpx; } + .mescroll-totop { + bottom: 100px !important; + }