docs: code split docsearch (#10648)

This commit is contained in:
neverland 2022-05-29 10:19:13 +08:00 committed by GitHub
parent e5cc7fadeb
commit be22f4c1f8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -3,9 +3,6 @@
</template> </template>
<script> <script>
import '@docsearch/css';
import docsearch from '@docsearch/js';
export default { export default {
name: 'VanDocSearch', name: 'VanDocSearch',
@ -27,10 +24,13 @@ export default {
methods: { methods: {
initDocsearch() { initDocsearch() {
if (this.searchConfig) { if (this.searchConfig) {
docsearch({ import('@docsearch/css');
import('@docsearch/js').then((docsearch) => {
docsearch.default({
...this.searchConfig, ...this.searchConfig,
container: '#docsearch', container: '#docsearch',
}); });
});
} }
}, },
}, },