vue 登陆时回车键和点击都可以触发登陆事件

在表单最后的输入框添加(是最后的输入框) @keyup.enter.native="submitForm(‘ruleForm2’) 事件

<el-input
          type="password"
          autocomplete="new-password"
          show-password
          v-model="ruleForm2.password"
          placeholder="密码"
          @keyup.enter.native="submitForm('ruleForm2')"
        ></el-input>

登陆按钮添加 @click="submitForm(‘ruleForm2’)"事件

<el-button
          type="primary"
          style="width:100%;"
          @click="submitForm('ruleForm2')"
          :loading="logining"
        >登录</el-button>

登录时在vue项目中使用md5加密

npm安装:

npm install --save js-md5

1.在需要使用的项目文件中引入:

import md5 from 'js-md5';

使用:

md5('holle')  // bcecb35d0a12baad472fbe0392bcc043

2.或者在main.js文件中将md5转换成vue原型:

import md5 from 'js-md5';
Vue.prototype.$md5 = md5;

在需要用到的文件中使用:

this.$md5('holle') // bcecb35d0a12baad472fbe0392bcc043

 this.$md5('1').toUpperCase()  //将小写转成大写

Logo

前往低代码交流专区

更多推荐