mirror of
https://github.com/youzan/vant.git
synced 2025-10-20 02:31:21 +00:00
fix(cli): docsearch anchor not work
This commit is contained in:
@@ -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}`],
|
||||||
|
Reference in New Issue
Block a user