From 7e3de28903ae74702608a8221aeefa3a87f9e53f Mon Sep 17 00:00:00 2001 From: DCloud_LXH <283700113@qq.com> Date: Fri, 18 Mar 2022 11:05:52 +0800 Subject: [PATCH] =?UTF-8?q?wip:=20=E6=A0=B7=E5=BC=8F=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../DcloudSearchPage/components/Result.vue | 16 ++++++++++------ .../DcloudSearchPage/components/Results.vue | 19 ++++++++++++------- .../components/DcloudSearchPage/index.vue | 13 ++++++++----- 3 files changed, 30 insertions(+), 18 deletions(-) diff --git a/docs/.vuepress/theme/components/DcloudSearchPage/components/Result.vue b/docs/.vuepress/theme/components/DcloudSearchPage/components/Result.vue index 45b4d1e4f..37d383862 100644 --- a/docs/.vuepress/theme/components/DcloudSearchPage/components/Result.vue +++ b/docs/.vuepress/theme/components/DcloudSearchPage/components/Result.vue @@ -75,17 +75,21 @@ }, }; - diff --git a/docs/.vuepress/theme/components/DcloudSearchPage/components/Results.vue b/docs/.vuepress/theme/components/DcloudSearchPage/components/Results.vue index 2f3a86f04..1b31198d0 100644 --- a/docs/.vuepress/theme/components/DcloudSearchPage/components/Results.vue +++ b/docs/.vuepress/theme/components/DcloudSearchPage/components/Results.vue @@ -29,14 +29,19 @@ methods: {}, }; - diff --git a/docs/.vuepress/theme/components/DcloudSearchPage/index.vue b/docs/.vuepress/theme/components/DcloudSearchPage/index.vue index 4d4530d9d..2fbaf3cf4 100644 --- a/docs/.vuepress/theme/components/DcloudSearchPage/index.vue +++ b/docs/.vuepress/theme/components/DcloudSearchPage/index.vue @@ -133,8 +133,8 @@ resultList: [], searchPage: 0, // 跳转页数 - curHits: 0, // 当前搜索条数 - totalPage: 0, // 搜索结果总共条数 + curHits: 0, // 当前搜索结果总条数 + totalPage: 0, // 搜索结果总共页数 curPage: 1, // 当前页 pageSize: 0, // 每页条数 }; @@ -144,6 +144,9 @@ showPagination() { return !!(this.resultList.length && this.totalPage > 1); }, + currentCategory() { + return this.category[this.categoryIndex]; + }, }, mounted() { @@ -159,14 +162,13 @@ openSearch(val) { this.$nextTick(() => { if (val) { - this.$nextTick(forbidScroll); + forbidScroll(); document.body.appendChild(this.$el); this.$nextTick(() => this.$refs.searchInput.focus()); } else { this.cancel(); forbidScroll(false); document.body.removeChild(this.$el); - // window.removeEventListener('keydown', this.onKeyDown); } }); }, @@ -181,6 +183,7 @@ resetSearchPage() { this.searchPage = 0; }, + research(curPage) { this.searchPage = curPage - 1; this.search(); @@ -188,7 +191,7 @@ search() { if (!this.searchValue) return; - const { text, type } = this.category[this.categoryIndex]; + const { text, type } = this.currentCategory; switch (type) { case 'algolia': this.searchByAlgolia(this.searchValue, this.searchPage).then( -- GitLab