import { defineComponent, onMounted, reactive } from 'vue'; import styles from './index.module.less'; import { NButton, NForm, NFormItem, NSpace } from 'naive-ui'; import iconAdd from '../../images/icon-add.svg'; import TheSearch from '/src/components/TheSearch'; import { resourceTypeArray } from '/src/utils/searchArray'; import { useCatchStore } from '/src/store/modules/catchData'; export default defineComponent({ name: 'search-group', emits: ['search', 'add'], setup(props, { emit }) { const catchStore = useCatchStore(); const forms = reactive({ type: 'MUSIC', // keyword: '', bookVersionId: null, subjectId: null }); const onSearch = () => { emit('search', forms); }; onMounted(async () => { // 获取教材分类列表 await catchStore.getMusicSheetCategory(); // 获取声部列表 await catchStore.getSubjects(); }); return () => (
{resourceTypeArray.map((item: any) => ( { forms.type = item.value; onSearch(); }}> {item.label} ))} emit('add')}> 添加自定义教材
{forms.type === 'MUSIC' && ( {catchStore.getAllMusicCategories.map((music: any) => ( { forms.bookVersionId = music.id; onSearch(); }}> {music.name} ))} )} {catchStore.getSubjectAllList.map((subject: any) => ( { forms.subjectId = subject.id; onSearch(); }}> {subject.name} ))} { forms.keyword = val; onSearch(); }} />
); } });