From ff5e3b28d08f8b8e307832b7df1e3d14faaed0bb Mon Sep 17 00:00:00 2001 From: Book Pauk Date: Sat, 20 Aug 2022 21:34:20 +0700 Subject: [PATCH] =?UTF-8?q?=D0=94=D0=BE=D0=B1=D0=B0=D0=B2=D0=BB=D0=B5?= =?UTF-8?q?=D0=BD=20PageScroller?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Search/PageScroller/PageScroller.vue | 58 +++++++++++++++++++ client/components/Search/Search.vue | 43 +++++--------- client/components/share/NumInput.vue | 8 ++- 3 files changed, 79 insertions(+), 30 deletions(-) create mode 100644 client/components/Search/PageScroller/PageScroller.vue diff --git a/client/components/Search/PageScroller/PageScroller.vue b/client/components/Search/PageScroller/PageScroller.vue new file mode 100644 index 0000000..161ea1c --- /dev/null +++ b/client/components/Search/PageScroller/PageScroller.vue @@ -0,0 +1,58 @@ + + + + + \ No newline at end of file diff --git a/client/components/Search/Search.vue b/client/components/Search/Search.vue index 57dcb14..49f738a 100644 --- a/client/components/Search/Search.vue +++ b/client/components/Search/Search.vue @@ -62,7 +62,7 @@ @click="selectLang" />
- +
@@ -76,18 +76,9 @@
-
-
- Страница -
-
- -
-
- из {{ totalPages }} -
+
+
-
@@ -97,18 +88,9 @@
-
-
- Страница -
-
- -
-
- из {{ totalPages }} -
+
+
-
@@ -117,14 +99,14 @@ //----------------------------------------------------------------------------- import vueComponent from '../vueComponent.js'; -import NumInput from '../share/NumInput.vue'; +import PageScroller from './PageScroller/PageScroller.vue'; import * as utils from '../../share/utils'; //import _ from 'lodash'; const componentOptions = { components: { - NumInput, + PageScroller, }, watch: { config() { @@ -250,13 +232,19 @@ class Search { if (curScrollTop - this.lastScrollTop > 0) { this.$refs.toolPanel.style.position = 'relative'; this.$refs.toolPanel.style.top = `${this.lastScrollTop2}px`; - } else if (curScrollTop - this.lastScrollTop < 0) { + } else if (curScrollTop - this.lastScrollTop <= 0) { this.$refs.toolPanel.style.position = 'sticky'; this.$refs.toolPanel.style.top = 0; this.lastScrollTop2 = curScrollTop; } - this.lastScrollTop = curScrollTop; + this.lastScrollTop = curScrollTop; + } + + scrollToTop() { + this.$refs.scroller.scrollTop = 0; + const curScrollTop = this.$refs.scroller.scrollTop; + this.lastScrollTop = curScrollTop; } get foundAuthorsMessage() { @@ -323,6 +311,7 @@ class Search { this.searchResult = result; await this.updateTableData(); + this.scrollToTop(); } catch (e) { this.$root.stdDialog.alert(e.message, 'Ошибка'); return; diff --git a/client/components/share/NumInput.vue b/client/components/share/NumInput.vue index 9cf2ed3..c0aab0a 100644 --- a/client/components/share/NumInput.vue +++ b/client/components/share/NumInput.vue @@ -12,7 +12,7 @@