element ui 彈出框點擊提交,出現錯誤提示後,咱們在打開的時候每每錯誤信息仍是顯示出來。咱們在打開時調用重置函數,會出現下拉框在驗證的錯誤顯示的狀態下,改變下拉框的值錯誤提示不會消失,咱們能夠經過刷新的方式來實現重置的功能。函數
<el-dialog :visible.sync="dialogVisible" size="tiny" :show-close="false" :before-close="closeChangeMachie"> <el-form :model="ruleForm" :rules="rules" ref="ruleForm" label-width="150px" class="demo-ruleForm"> <el-form-item label="選擇門店:" prop="region"> <el-select v-model="ruleForm.region" placeholder="請選擇門店"> <el-option v-for="shop in shoppingData" :label="shop" :value="shop"></el-option> </el-select> </el-form-item> <el-form-item label="選擇機器號:" prop="machine"> <el-select v-model="ruleForm.machine" placeholder="請選擇機器號"> <el-option v-for="num in machineNum" :label="num" :value="num"></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> </el-dialog> //js代碼
//before-close 關閉前的回調,會暫停 Dialog 的關閉function(done),done 用於關閉 Dialog
closeChangeMachie(done){
done();
window.location.reload();
}