import { defineComponent, onMounted, ref } from 'vue'; import styles from './index.module.less'; import { NButton, NSpace, useMessage } from 'naive-ui'; import { useCatchStore } from '/src/store/modules/catchData'; import iconSelect from '../../images/icon-select.png'; export default defineComponent({ name: 'subject-sync', props: { subjectId: { type: [String, Number], default: '' } }, emits: ['close', 'confirm'], setup(props, { emit }) { const catchStore = useCatchStore(); const message = useMessage(); const selectSubjectIds = ref([] as any); const onSubmit = () => { if (selectSubjectIds.value.length <= 0) { message.error('至少选择一个声部进行同步'); return; } emit('confirm', selectSubjectIds.value); }; onMounted(async () => { // 获取教材分类列表 await catchStore.getSubjects(); if (props.subjectId) { selectSubjectIds.value = [Number(props.subjectId)]; } }); return () => (
{subject.name}