fix(form): fieldset初始化时就触发了change事件

This commit is contained in:
roymondchen 2023-04-26 11:17:48 +08:00
parent ea4af425f3
commit 982cc4685e

View File

@ -10,6 +10,7 @@
:prop="`${prop}${prop ? '.' : ''}${config.name}.value`"
:true-label="1"
:false-label="0"
@update:modelValue="change"
><span v-html="config.legend"></span><span v-if="config.extra" v-html="config.extra" class="m-form-tip"></span
></TMagicCheckbox>
</component>
@ -61,7 +62,7 @@
</template>
<script lang="ts" setup name="MFormFieldset">
import { computed, inject, watch } from 'vue';
import { computed, inject } from 'vue';
import { TMagicCheckbox } from '@tmagic/design';
@ -115,13 +116,5 @@ const change = () => {
const key = (item: any, index: number) => item[mForm?.keyProp || '__key'] ?? index;
if (props.config.checkbox && name.value) {
watch(
() => props.model[name.value]?.value,
() => {
emit('change', props.model);
},
);
}
const onAddDiffCount = () => emit('addDiffCount');
</script>