Skip to content

Commit 82b0b33

Browse files
committed
fix: 修复格式错误
1 parent a5fa9c4 commit 82b0b33

184 files changed

Lines changed: 15952 additions & 2 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
import { defineComponent, onMounted, watch, nextTick, mergeProps, useSSRContext } from "vue";
2+
import { ssrRenderAttrs } from "vue/server-renderer";
3+
import docsearch from "@docsearch/js";
4+
import { u as useRouter, a as useRoute, b as useData } from "./app.js";
5+
import "@vueuse/core";
6+
import "./plugin-vue_export-helper.1tPrXgE0.js";
7+
const _sfc_main = /* @__PURE__ */ defineComponent({
8+
__name: "VPAlgoliaSearchBox",
9+
__ssrInlineRender: true,
10+
props: {
11+
algolia: {}
12+
},
13+
setup(__props) {
14+
const props = __props;
15+
const router = useRouter();
16+
const route = useRoute();
17+
const { site, localeIndex, lang } = useData();
18+
onMounted(update);
19+
watch(localeIndex, update);
20+
async function update() {
21+
var _a, _b;
22+
await nextTick();
23+
const options = {
24+
...props.algolia,
25+
...(_a = props.algolia.locales) == null ? void 0 : _a[localeIndex.value]
26+
};
27+
const rawFacetFilters = ((_b = options.searchParameters) == null ? void 0 : _b.facetFilters) ?? [];
28+
const facetFilters = [
29+
...(Array.isArray(rawFacetFilters) ? rawFacetFilters : [rawFacetFilters]).filter((f) => !f.startsWith("lang:")),
30+
`lang:${lang.value}`
31+
];
32+
initialize({
33+
...options,
34+
searchParameters: {
35+
...options.searchParameters,
36+
facetFilters
37+
}
38+
});
39+
}
40+
function initialize(userOptions) {
41+
const options = Object.assign({}, userOptions, {
42+
container: "#docsearch",
43+
navigator: {
44+
navigate({ itemUrl }) {
45+
const { pathname: hitPathname } = new URL(
46+
window.location.origin + itemUrl
47+
);
48+
if (route.path === hitPathname) {
49+
window.location.assign(window.location.origin + itemUrl);
50+
} else {
51+
router.go(itemUrl);
52+
}
53+
}
54+
},
55+
transformItems(items) {
56+
return items.map((item) => {
57+
return Object.assign({}, item, {
58+
url: getRelativePath(item.url)
59+
});
60+
});
61+
},
62+
hitComponent({ hit, children }) {
63+
return {
64+
__v: null,
65+
type: "a",
66+
ref: void 0,
67+
constructor: void 0,
68+
key: void 0,
69+
props: { href: hit.url, children }
70+
};
71+
}
72+
});
73+
docsearch(options);
74+
}
75+
function getRelativePath(url) {
76+
const { pathname, hash } = new URL(url, location.origin);
77+
return pathname.replace(/\.html$/, site.value.cleanUrls ? "" : ".html") + hash;
78+
}
79+
return (_ctx, _push, _parent, _attrs) => {
80+
_push(`<div${ssrRenderAttrs(mergeProps({ id: "docsearch" }, _attrs))}></div>`);
81+
};
82+
}
83+
});
84+
const _sfc_setup = _sfc_main.setup;
85+
_sfc_main.setup = (props, ctx) => {
86+
const ssrContext = useSSRContext();
87+
(ssrContext.modules || (ssrContext.modules = /* @__PURE__ */ new Set())).add("../node_modules/vitepress/dist/client/theme-default/components/VPAlgoliaSearchBox.vue");
88+
return _sfc_setup ? _sfc_setup(props, ctx) : void 0;
89+
};
90+
export {
91+
_sfc_main as default
92+
};

docs/.vitepress/.temp/_headers

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
/assets/*
2+
cache-control: max-age=31536000
3+
cache-control: immutable

docs/.vitepress/.temp/app.js

Lines changed: 5218 additions & 0 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)