提交 c6f1322f 编写于 作者: B boaz0 提交者: Franck Abgrall

Add search box placeholder setting to theme-config (#1834)

Signed-off-by: NBoaz Shuster <boaz.shuster.github@gmail.com>
上级 696717b7
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
aria-label="Search" aria-label="Search"
:value="query" :value="query"
:class="{ 'focused': focused }" :class="{ 'focused': focused }"
:placeholder="placeholder"
autocomplete="off" autocomplete="off"
spellcheck="false" spellcheck="false"
@focus="focused = true" @focus="focused = true"
...@@ -42,10 +43,14 @@ export default { ...@@ -42,10 +43,14 @@ export default {
return { return {
query: '', query: '',
focused: false, focused: false,
focusIndex: 0 focusIndex: 0,
placeholder: undefined
} }
}, },
mounted () {
this.placeholder = this.$site.themeConfig.searchPlaceholder || ''
},
computed: { computed: {
showSuggestions () { showSuggestions () {
return ( return (
......
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
<input <input
id="algolia-search-input" id="algolia-search-input"
class="search-query" class="search-query"
:placeholder="placeholder"
> >
</form> </form>
</template> </template>
...@@ -15,8 +16,15 @@ ...@@ -15,8 +16,15 @@
export default { export default {
props: ['options'], props: ['options'],
data () {
return {
placeholder: undefined
}
},
mounted () { mounted () {
this.initialize(this.options, this.$lang) this.initialize(this.options, this.$lang)
this.placeholder = this.$site.themeConfig.searchPlaceholder || ''
}, },
methods: { methods: {
......
...@@ -351,6 +351,18 @@ Unlike the [built-in search](#built-in-search) engine which works out of the box ...@@ -351,6 +351,18 @@ Unlike the [built-in search](#built-in-search) engine which works out of the box
For more options, check out [Algolia DocSearch’s documentation](https://github.com/algolia/docsearch#docsearch-options). For more options, check out [Algolia DocSearch’s documentation](https://github.com/algolia/docsearch#docsearch-options).
### Search Placeholder
You can define a placeholder for the search box by adding the `searchPlaceholder` attribute:
``` js
module.exports = {
themeConfig: {
searchPlaceholder: 'Search...'
}
}
```
## Last Updated ## Last Updated
The `themeConfig.lastUpdated` option allows you to get the UNIX timestamp(ms) of each file’s last `git` commit, and it will also display at the bottom of each page in an appropriate format: The `themeConfig.lastUpdated` option allows you to get the UNIX timestamp(ms) of each file’s last `git` commit, and it will also display at the bottom of each page in an appropriate format:
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册