1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85
| <template> <div v-if="open" class="modal"> <div class="modal-main"> <div class="modal-header"> <a @click="sendOpen"><i class="icon-cross"></i></a> </div> <div class="modal-body"> <el-form ref="formRef" :model="dynamicValidateForm" label-width="120px" class="demo-dynamic" > <el-form-item prop="email" label="Email" :rules="[ { required: true, message: 'Please input email address', trigger: 'blur', }, { type: 'email', message: 'Please input correct email address', trigger: ['blur', 'change'], }, ]" > <el-input v-model="dynamicValidateForm.email" /> </el-form-item> <el-form-item v-for="(domain, index) in dynamicValidateForm.domains" :key="domain.key" :label="'Domain' + index" :prop="'domains.' + index + '.value'" :rules="{ required: true, message: 'domain can not be null', trigger: 'blur', }" > <el-input v-model="domain.value" /> <el-button class="mt-2" @click.prevent="sendRemoveDomain(domain)" >Delete</el-button > </el-form-item> <el-form-item> <el-button type="primary" @click="sendSubmitForm(formRef)">Submit</el-button> <el-button @click="sendAddDomain">New domain</el-button> <el-button @click="sendResetForm(formRef)">Reset</el-button> </el-form-item> </el-form> </div> </div> </div> </template>
<script setup lang="ts"> import { defineProps } from 'vue'
const props = defineProps({ open: { type: Boolean }, lists: { type: Object }, dynamicValidateForm: { type: Object }, formRef: { type: Object }, })
const emits = defineEmits(['sendOpen', 'sendRemoveDomain', 'sendSubmitForm','sendResetForm', 'sendAddDomain']); const sendOpen = () => { emits('sendOpen', props.open=false) } const sendRemoveDomain = (domain:any) => { emits('sendRemoveDomain', domain) } const sendSubmitForm = (formRef: any) => { emits('sendSubmitForm', formRef) } const sendResetForm = (formRef: any) => { emits('sendResetForm', formRef) } const sendAddDomain = () => { emits('sendAddDomain') } </script>
|