fix(cli): remove docsearch (#11415)

* fix(cli): remove docsearch

* chore: remove react

* docs: add changelog
This commit is contained in:
neverland
2022-12-24 15:55:36 +08:00
committed by GitHub
parent 816a7cbdfb
commit c02ad9ce07
9 changed files with 7 additions and 326 deletions
@@ -64,12 +64,6 @@
{{ langLabel }}
</a>
</li>
<search-input
v-if="searchConfig"
:lang="lang"
:search-config="searchConfig"
/>
</ul>
</div>
</div>
@@ -77,17 +71,12 @@
</template>
<script>
import SearchInput from './SearchInput.vue';
import { packageVersion } from 'site-desktop-shared';
import { getDefaultTheme, syncThemeToChild } from '../../common/iframe-sync';
export default {
name: 'VanDocHeader',
components: {
SearchInput,
},
props: {
lang: String,
config: Object,
@@ -122,10 +111,6 @@ export default {
return {};
},
searchConfig() {
return this.config.searchConfig;
},
themeImg() {
if (this.currentTheme === 'light') {
return 'https://b.yzcdn.cn/vant/dark-theme.svg';
@@ -1,63 +0,0 @@
<template>
<div id="docsearch" />
</template>
<script>
export default {
name: 'VanDocSearch',
props: {
lang: String,
searchConfig: Object,
},
watch: {
lang() {
this.initDocsearch();
},
},
mounted() {
this.initDocsearch();
},
methods: {
initDocsearch() {
if (this.searchConfig) {
import('@docsearch/css');
import('@docsearch/js').then((docsearch) => {
docsearch.default({
...this.searchConfig,
container: '#docsearch',
});
});
}
},
},
};
</script>
<style lang="less">
#docsearch {
display: inline-block;
vertical-align: middle;
}
.DocSearch-Button {
height: 32px;
background: #f7f8fa;
&:hover {
box-shadow: none;
}
}
.DocSearch-Search-Icon {
width: 18px;
height: 18px;
}
.DocSearch-Button-Key {
font-size: 12px;
}
</style>