https://blog.csdn.net/qq_36437172/article/details/97139963`
//data
const checkOvertime = (rule, value, callback) => {
const honor_max = this.$refs.honor_max.value
if (value && honor_max) {
callback()
} else {
if (!value) {
callback(new Error('請輸入最大值'))
}
if (!honor_max) {
callback(new Error('請輸入最小值'))
}
}
}
honor_min: [
{ required: true, validator: checkOvertime, trigger: 'blur' },
{ min: 1, max: 150, message: '長度在 1 到 150 個字元', trigger: 'blur' }
],
<el-form-item label="榮譽值" prop="honor_min">
<el-col :span="2">
<el-input v-model="formData.honor_min" placeholder="最小榮譽值"/>
</el-col>
<el-col :span="2" :offset="1" prop="honor_max">
<el-input ref="honor_max" v-model="formData.honor_max" placeholder="最大榮譽值"/>
</el-col>
</el-form-item>
https://blog.csdn.net/qq_36437172/article/details/97139963
轉載