Quellcode durchsuchen

底部表单校验优化

ctt_ywq
congzc vor 2 Jahren
Ursprung
Commit
39deacb5b4
1 geänderte Dateien mit 21 neuen und 2 gelöschten Zeilen
  1. +21
    -2
      src/components/common/tail.vue

+ 21
- 2
src/components/common/tail.vue Datei anzeigen

@@ -33,7 +33,7 @@
<div class="subBtn" @click="submit()">
{{ characters == 1 ? '提交' : 'Submit' }}
</div> -->
<el-form ref="form" :rules="characters == 1 ? rules : rulesEnglish" :model="form">
<el-form v-if="showForm" ref="form" :rules="rules1" :model="form">
<el-form-item class="width" prop="userName">
<el-input v-model="form.userName" maxlength="10" :placeholder="characters == 1 ? '姓名' : 'Name'"></el-input>
</el-form-item>
@@ -195,7 +195,9 @@ export default {
}
}
]
}
},
rules1: null,
showForm: true
};
},
methods: {
@@ -248,10 +250,27 @@ export default {
});
}
},
created() {
this.rules1 = this.rules;
},
computed: {
...mapState({
characters: state => state.publicObj.characters
})
},
watch: {
characters: function (newValue) {
this.showForm = false;
if (newValue === 1) {
this.rules1 = this.rules;
} else {
this.rules1 = this.rulesEnglish;
}
setTimeout(() => {
this.showForm = true;
}, 100);
}
}
};
</script>


Laden…
Abbrechen
Speichern