fix: 系统管理表单增加回车保存事件

This commit is contained in:
fit2cloud-chenyw 2021-06-16 19:30:26 +08:00
parent a01c7f74ff
commit 2bead0a66e
2 changed files with 19 additions and 0 deletions

View File

@ -169,7 +169,25 @@ export default {
}
this.initRoles()
},
mounted() {
this.bindKey()
},
destroyed() {
this.unBindKey()
},
methods: {
entryKey(event) {
const keyCode = event.keyCode
if (keyCode === 13) {
this.save()
}
},
bindKey() {
document.addEventListener('keyup', this.entryKey)
},
unBindKey() {
document.removeEventListener('keyup', this.entryKey)
},
repeatValidator(rule, value, callback) {
if (value !== this.form.password) {
callback(new Error(this.$t('member.inconsistent_passwords')))

View File

@ -143,6 +143,7 @@
label-width="120px"
:rules="rule"
class="demo-ruleForm"
@keyup.enter.native="editUserPassword('editPasswordForm')"
>
<el-form-item :label="$t('member.new_password')" prop="newPassword">
<el-input v-model="ruleForm.newPassword" type="password" autocomplete="off" show-password />