import { isZhCN } from '../utils/util'; import packageInfo from '../../package.json'; import logo from '../assets/logo.svg'; import antDesignVue from '../assets/ant-design-vue.svg'; import { SearchOutlined } from '@ant-design/icons-vue'; export default { props: { name: String, searchData: Array, }, data() { return { value: null, }; }, mounted() { this.initDocSearch(this.$i18n.locale); }, methods: { handleClose(key) { localStorage.removeItem('jobs-notification-key'); localStorage.setItem('jobs-notification-key', key); }, initDocSearch(locale) { window.docsearch({ apiKey: '92003c1d1d07beef165b08446f4224a3', indexName: 'antdv', inputSelector: '#search-box input', algoliaOptions: { facetFilters: [isZhCN(locale) ? 'cn' : 'en'] }, transformData(hits) { hits.forEach(hit => { hit.url = hit.url.replace('www.antdv.com', window.location.host); hit.url = hit.url.replace('https:', window.location.protocol); }); return hits; }, debug: false, // Set debug to true if you want to inspect the dropdown }); }, handleClick() { const name = this.name; const path = this.$route.path; const newName = isZhCN(name) ? name.replace(/-cn\/?$/, '') : `${name}-cn`; this.$router.push({ path: path.replace(name, newName), }); this.$i18n.locale = isZhCN(name) ? 'en-US' : 'zh-CN'; }, onSelect(val) { this.$router.push(val); this.value = val; }, }, render() { const name = this.name; const isCN = isZhCN(name); const path = this.$route.path; const selectedKeys = path === '/jobs/list-cn' ? ['jobs'] : ['components']; return ( ); }, };