<template>
    <Form 
        :defaultFormData="formData" 
        :formItemList="questionnaireBaseForm"
        :inlineLayout="false"
        v-model:formRef="formRef"
    ></Form>
</template>


<script setup lang="ts">
import {ref,watch} from 'vue'
import Form from '@/baseComponents/Form.vue';
import {questionnaireBaseForm,} from './form'

interface FormItm {
    assessmentTitle:String,
    assessmentIllustrate:String
}

const props = defineProps({
    defaultFormData:{
        type:Object as () => FormItm,
        required:true
    }
})
const emit = defineEmits(['formChange'])

const formRef = defineModel('formRef')

const formData = ref({})

watch(()=>props.defaultFormData,(newVal)=>{
    formData.value = {...newVal}
})

watch(()=>formData.value,(newVal)=>{
    emit('formChange',newVal)
},{deep:true})

</script>