提交 0f4535c2 编写于 作者: D DCloud_LXH

update: algoliaSearchBox

上级 08804261
...@@ -4,6 +4,7 @@ ...@@ -4,6 +4,7 @@
<script> <script>
import '@docsearch/css'; import '@docsearch/css';
import { createElement } from 'preact';
const resolveRoutePathFromUrl = (url, base = '/') => const resolveRoutePathFromUrl = (url, base = '/') =>
url url
...@@ -17,6 +18,10 @@ ...@@ -17,6 +18,10 @@
return docsearch.default; return docsearch.default;
}; };
const isSpecialClick = event => {
return event.button === 1 || event.altKey || event.ctrlKey || event.metaKey || event.shiftKey;
};
const translations = { const translations = {
button: { button: {
buttonText: '搜索文档', buttonText: '搜索文档',
...@@ -78,7 +83,7 @@ ...@@ -78,7 +83,7 @@
methods: { methods: {
initialize(userOptions, lang) { initialize(userOptions, lang) {
loadDocsearch().then(docsearch => { loadDocsearch().then(docsearch => {
const { algoliaOptions = {} } = userOptions; const { searchParameters = {} } = userOptions;
docsearch( docsearch(
Object.assign({}, userOptions, { Object.assign({}, userOptions, {
placeholder: '搜索', placeholder: '搜索',
...@@ -86,8 +91,8 @@ ...@@ -86,8 +91,8 @@
container: '#docsearch', container: '#docsearch',
// #697 Make docsearch work well at i18n mode. // #697 Make docsearch work well at i18n mode.
searchParameters: { searchParameters: {
...algoliaOptions, ...searchParameters,
facetFilters: [`lang:${lang}`].concat(algoliaOptions.facetFilters || []), facetFilters: [`lang:${lang}`].concat(searchParameters.facetFilters || []),
}, },
navigator: { navigator: {
// when pressing Enter without metaKey // when pressing Enter without metaKey
...@@ -108,8 +113,8 @@ ...@@ -108,8 +113,8 @@
}; };
}), }),
// handle `onClick` by `this.$routerpush` // handle `onClick` by `this.$routerpush`
/* hitComponent: ({ hit, children }) => { hitComponent: ({ hit, children }) =>
const vnode = createElement( createElement(
'a', 'a',
{ {
href: hit.url, href: hit.url,
...@@ -122,11 +127,7 @@ ...@@ -122,11 +127,7 @@
}, },
}, },
children children
); ),
console.log('vnode :>> ', vnode);
console.log('children :>> ', children);
return vnode;
}, */
}) })
); );
}); });
......
此差异已折叠。
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册