mirror of
https://gitee.com/vant-contrib/vant.git
synced 2025-04-06 03:57:59 +08:00
fix(cli): docsearch anchor not work
This commit is contained in:
parent
0252710155
commit
a872a070e4
@ -29,6 +29,17 @@ export default {
|
|||||||
if (this.searchConfig) {
|
if (this.searchConfig) {
|
||||||
this.docsearchInstance = window.docsearch({
|
this.docsearchInstance = window.docsearch({
|
||||||
...this.searchConfig,
|
...this.searchConfig,
|
||||||
|
transformData: (hits) => {
|
||||||
|
hits.forEach((hit) => {
|
||||||
|
if (hit.anchor) {
|
||||||
|
hit.url = hit.url + '#' + hit.anchor;
|
||||||
|
hit.anchor = null;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
if (this.searchConfig.transformData) {
|
||||||
|
this.searchConfig.transformData(hits);
|
||||||
|
}
|
||||||
|
},
|
||||||
inputSelector: '.van-doc-search',
|
inputSelector: '.van-doc-search',
|
||||||
algoliaOptions: {
|
algoliaOptions: {
|
||||||
facetFilters: [`lang:${this.lang}`],
|
facetFilters: [`lang:${this.lang}`],
|
||||||
|
Loading…
x
Reference in New Issue
Block a user