<el-form label-width="100px" :model="ruleForm" :rules="rules" ref="ruleForm">
<el-form-item label="活动区域" prop="region">
<el-select v-model="ruleForm.region" placeholder="请选择活动区域">
<el-option label="区域一" value="shanghai"></el-option>
<el-option label="区域二" value="beijing"></el-option>
</el-select>
</el-form-item>
<el-form-item>
<el-button type="primary" @click="submitForm('ruleForm')">立即创建</el-button>
<el-button @click="resetForm('ruleForm')">重置</el-button>
</el-form-item>
</el-form>
ruleForm: {
region: "",
},
rules: {
region: [
{ required: true, message: "请选择活动区域", trigger: "change" },
],
},
submitForm(fromRef) {
this.$refs[fromRef].validate((booleanIfSelect) => {
console.log(booleanIfSelect);
});
},
resetForm(fromRef) {
this.$refs[fromRef].resetFields();
},