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 () => (
请选择当前课件可使用的乐器 (勾选后则对应乐器下的课件内容将被当前课件内容全部替换)
{catchStore.getSubjectList.map((subject: any) => (
{ if (selectSubjectIds.value.includes(subject.id)) { const index = selectSubjectIds.value.indexOf(subject.id); selectSubjectIds.value.splice(index, 1); } else { selectSubjectIds.value.push(subject.id); } }}>
{selectSubjectIds.value.includes(subject.id) && ( )}

{subject.name}

))}
emit('close')}> 取消 确定
); } });