import { defineComponent, onMounted, ref } from 'vue'; import styles from './index.module.less'; import { NButton, NScrollbar, NSpace } from 'naive-ui'; import { useCatchStore } from '/src/store/modules/catchData'; import iconSelect from '../../../prepare-lessons/images/icon-select.png'; export default defineComponent({ name: 'subject-sync', emits: ['close', 'confirm'], setup(props, { emit }) { const catchStore = useCatchStore(); const selectSubjectId = ref(null as any); const subjectList = ref([] as any); const onSubmit = () => { const item = subjectList.value.find( (subject: any) => subject.id === selectSubjectId.value ); emit('confirm', item); }; onMounted(async () => { // await catchStore.getSubjects(); await catchStore.getMusicInstrument(); subjectList.value = catchStore.getMusicInstruments; if (subjectList.value.length > 0) { selectSubjectId.value = subjectList.value[0].id; } }); return () => (
{subject.name}