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