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

update: algoliaSearchBox

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