提交 93f3b210 编写于 作者: D DCloud_LXH

fix: build javascript out of memory

上级 7f8d0e5f
...@@ -126,8 +126,8 @@ ...@@ -126,8 +126,8 @@
:pageSize="pageSize" :pageSize="pageSize"
/> />
<a v-if="showMoreAsk" class="search-more" @click="moreAskResult"> <a v-if="showMoreAsk" class="search-more" @click="moreAskResult">
<span v-if="showAskLoading" class="uni-loading"></span> <span v-if="showServerLoading" class="uni-loading"></span>
<span v-else>更多...</span> <span v-else>{{ hasNoMoreServerResult ? '没有更多了' : '更多...' }}</span>
</a> </a>
</div> </div>
</div> </div>
...@@ -204,7 +204,8 @@ ...@@ -204,7 +204,8 @@
noResult: false, noResult: false,
serverHtml: '', serverHtml: '',
showLoading: false, showLoading: false,
showAskLoading: false, showServerLoading: false,
hasNoMoreServerResult: false,
searchPage: 0, // 跳转页数 searchPage: 0, // 跳转页数
curHits: 0, // 当前搜索结果总条数 curHits: 0, // 当前搜索结果总条数
...@@ -371,24 +372,34 @@ ...@@ -371,24 +372,34 @@
this.noResult = !hits; this.noResult = !hits;
}); });
case 'ask': case 'ask':
append && (this.showAskLoading = true); append && (this.showServerLoading = true);
this.searchPage === 0 && (this.searchPage = 1); this.searchPage === 0 && (this.searchPage = 1);
return postAsk(query, this.searchPage) return postAsk(query, this.searchPage)
.then(res => { .then(res => {
if (res) { if (res) {
const { html, hits } = res; const { html = '', hits } = res;
!append ? (this.serverHtml = html) : (this.serverHtml += html); if (append) {
this.serverHtml += html;
} else {
this.hasNoMoreServerResult = false;
this.serverHtml = html;
}
this.noResult = !this.serverHtml.length; this.noResult = !this.serverHtml.length;
} else { } else {
this.serverHtml = '' if (append) {
this.noResult = true; this.hasNoMoreServerResult = true;
} else {
this.serverHtml = '';
this.noResult = true;
}
} }
}) })
.finally(() => (this.showAskLoading = false)); .finally(() => (this.showServerLoading = false));
} }
}, },
moreAskResult() { moreAskResult() {
if (this.hasNoMoreServerResult) return;
this.searchPage === 0 ? (this.searchPage = 2) : this.searchPage++; this.searchPage === 0 ? (this.searchPage = 2) : this.searchPage++;
this.searchByServer(true); this.searchByServer(true);
}, },
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
}, },
"scripts": { "scripts": {
"dev": "vuepress dev docs", "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": { "repository": {
"type": "git", "type": "git",
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册