diff --git a/docs/.vuepress/theme/components/DcloudSearchPage/index.vue b/docs/.vuepress/theme/components/DcloudSearchPage/index.vue index addd1182f46244ebc64f80ad168e87444b1fa7e2..4182b84bed564968222841da2289a5eae7d93113 100644 --- a/docs/.vuepress/theme/components/DcloudSearchPage/index.vue +++ b/docs/.vuepress/theme/components/DcloudSearchPage/index.vue @@ -126,8 +126,8 @@ :pageSize="pageSize" /> - - 更多... + + {{ hasNoMoreServerResult ? '没有更多了' : '更多...' }} @@ -204,7 +204,8 @@ noResult: false, serverHtml: '', showLoading: false, - showAskLoading: false, + showServerLoading: false, + hasNoMoreServerResult: false, searchPage: 0, // 跳转页数 curHits: 0, // 当前搜索结果总条数 @@ -371,24 +372,34 @@ this.noResult = !hits; }); case 'ask': - append && (this.showAskLoading = true); + append && (this.showServerLoading = true); this.searchPage === 0 && (this.searchPage = 1); return postAsk(query, this.searchPage) .then(res => { if (res) { - const { html, hits } = res; - !append ? (this.serverHtml = html) : (this.serverHtml += html); + const { html = '', hits } = res; + if (append) { + this.serverHtml += html; + } else { + this.hasNoMoreServerResult = false; + this.serverHtml = html; + } this.noResult = !this.serverHtml.length; } else { - this.serverHtml = '' - this.noResult = true; + if (append) { + this.hasNoMoreServerResult = true; + } else { + this.serverHtml = ''; + this.noResult = true; + } } }) - .finally(() => (this.showAskLoading = false)); + .finally(() => (this.showServerLoading = false)); } }, moreAskResult() { + if (this.hasNoMoreServerResult) return; this.searchPage === 0 ? (this.searchPage = 2) : this.searchPage++; this.searchByServer(true); }, diff --git a/package.json b/package.json index cdbbc71ae5f9e01d81bb7203f30230c0d73eaa2d..de3367f8bd9a30f0ffed142409f8c64c3d812b14 100644 --- a/package.json +++ b/package.json @@ -8,7 +8,7 @@ }, "scripts": { "dev": "vuepress dev docs", - "build": "vuepress build docs --no-cache" + "build": "node --max_old_space_size=3072 ./node_modules/vuepress/cli.js build docs --no-cache" }, "repository": { "type": "git",