import { SearchOutlined } from '@antdv-next/icons'; import { defineComponent, nextTick, type PropType, type Ref, ref } from 'vue'; import { RouterLink, useRouter } from 'vue-router'; import type { BlogArticle, BlogCategory, BlogTag } from '@/data/blog'; import { useBlogEventBus } from '@/hooks/useBlogEventBus'; import { useBlogTheme } from '@/hooks/useBlogTheme'; import { BlogButton, BlogInput } from './antdvComponents'; export default defineComponent({ name: 'BlogSidebar', props: { categories: { type: Array as PropType, required: true, }, tags: { type: Array as PropType, required: true, }, articles: { type: Array as PropType, required: true, }, part1Ref: { type: Object as PropType>, required: true, }, part2Ref: { type: Object as PropType>, required: true, }, }, setup(props) { const router = useRouter(); const eventBus = useBlogEventBus(); const { siteConfig } = useBlogTheme(); const keyword = ref(''); const leftbarSearchOpen = ref(false); const leftbarSearchInputRef = ref(null); /** * @param target antdv-next Input 组件实例或原生 input 节点。 */ const focusInput = (target: any) => { target?.focus?.(); target?.input?.focus?.(); }; const submitSearch = () => { const query = keyword.value.trim(); if (!query) { return; } router.push({ name: 'BlogSearch', query: { q: query }, }); }; return () => ( ); }, });