From fbb838e977b0d89e24b21d8d2e94a96231ccdb90 Mon Sep 17 00:00:00 2001 From: saki <sakihet@gmail.com> Date: Fri, 20 Apr 2018 11:29:06 +0900 Subject: [PATCH 1/2] feat: add suggestions num config --- lib/default-theme/SearchBox.vue | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/default-theme/SearchBox.vue b/lib/default-theme/SearchBox.vue index 7cfce9f4ca..4348e0c3ab 100644 --- a/lib/default-theme/SearchBox.vue +++ b/lib/default-theme/SearchBox.vue @@ -51,7 +51,7 @@ export default { return } - const max = 5 + const max = this.searchBoxConfig.suggestionsMax const { pages } = this.$site const localePath = this.$localePath const matches = item => ( @@ -88,6 +88,9 @@ export default { const navCount = (this.$site.themeConfig.nav || []).length const repo = this.$site.repo ? 1 : 0 return navCount + repo <= 2 + }, + searchBoxConfig () { + return Object.assign({ suggestionsMax: 5 }, this.$site.themeConfig.searchBox) } }, methods: { From 743ae3f1861ac905cc5ac9baf31373c24e0c7807 Mon Sep 17 00:00:00 2001 From: Evan You <yyx990803@gmail.com> Date: Mon, 23 Apr 2018 11:28:22 -0400 Subject: [PATCH 2/2] Update SearchBox.vue --- lib/default-theme/SearchBox.vue | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/lib/default-theme/SearchBox.vue b/lib/default-theme/SearchBox.vue index 4348e0c3ab..d81b53aba3 100644 --- a/lib/default-theme/SearchBox.vue +++ b/lib/default-theme/SearchBox.vue @@ -51,8 +51,8 @@ export default { return } - const max = this.searchBoxConfig.suggestionsMax - const { pages } = this.$site + const { pages, themeConfig } = this.$site + const max = themeConfig.searchMaxSuggestions || 5 const localePath = this.$localePath const matches = item => ( item.title && @@ -88,9 +88,6 @@ export default { const navCount = (this.$site.themeConfig.nav || []).length const repo = this.$site.repo ? 1 : 0 return navCount + repo <= 2 - }, - searchBoxConfig () { - return Object.assign({ suggestionsMax: 5 }, this.$site.themeConfig.searchBox) } }, methods: {