在输入框绑定 :required="form.delivery"
<el-form ref="form" :rules="rules" :model="form" label-width="80px">
<el-form-item label="即时配送" class="swi" prop="delivery">
<el-switch v-model="form.delivery"></el-switch>
</el-form-item>
<el-form-item label="即时配送" class="swi" prop="info" :required="form.delivery">
<el-input v-model="form.info"></el-input>
</el-form-item>
<el-button type="primary" @click="onSubmit">立即创建</el-button>
</el-form>
<script>
export default {
name: "Index",
data: () => ({
form:{
delivery:false,
info:"",
},
rules: {
info: [{message: '必须填写用户名', trigger: 'blur'}],
},
}),
}
</script>
所有评论(0)