import { PropType, defineComponent, onMounted, reactive } from 'vue'; import styles from './index.module.less'; import { NButton, NSpace } from 'naive-ui'; import TheSearch from '/src/components/TheSearch'; export default defineComponent({ name: 'search-group', props: { categoryChildList: { type: Array as PropType, default: () => [] }, wikiCategoryId: { type: String, default: '' } }, emits: ['search', 'add'], expose: ['init'], setup(props, { emit }) { // const catchStore = useCatchStore(); const forms = reactive({ keyword: '', wikiCategoryId: props.wikiCategoryId || '' }); const onSearch = () => { emit('search', forms); }; onMounted(async () => { // 获取教材分类列表 // await catchStore.getMusicSheetCategory() }); return () => (
{props.categoryChildList.length > 0 ? ( { forms.wikiCategoryId = props.wikiCategoryId; onSearch(); }}> 全部 ) : ( )} {props.categoryChildList.map((item: any) => ( { forms.wikiCategoryId = item.id; onSearch(); }}> {item.name} ))} { forms.keyword = val; onSearch(); }} />
); } });