import { defineComponent } from 'vue' import useSearchStore from './useSearchStore' import jump from '@/utils/jump' import useSearchConfigStore from './useSearchConfigStore' import { OhVueIcon, addIcons } from 'oh-vue-icons' import { MdSearch } from 'oh-vue-icons/icons' import { aIUrl, translateUrl } from '@/config' addIcons(MdSearch) export const Item = defineComponent({ props: { icon: { type: Object, default: null }, label: { type: String, default: '' }, path: { type: String, default: '' }, prefix: { type: String, default: '' }, num: { type: Number, default: 0 }, current: { type: Number, default: -1 } }, setup(props) { const searchConfig = useSearchConfigStore() const search = useSearchStore() return () => (
{ searchConfig.addHistory(props.path) search.searchStr = '' jump(props.prefix + props.path) }} > {props.icon}
{props.label + props.path}
) } }) export default defineComponent(() => { const search = useSearchStore() const searchConfig = useSearchConfigStore() return () => (
} current={search.current} num={0} /> } current={search.current} num={1} /> {search.sugList.map((el, idx) => ( } current={search.current} num={idx + 2} /> ))}
) })