feat:add showPwd

This commit is contained in:
Pan 2017-11-24 14:46:19 +08:00 committed by 花裤衩
parent 890cfe5860
commit 29ec7f8a18
2 changed files with 12 additions and 2 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 66 KiB

After

Width:  |  Height:  |  Size: 66 KiB

View File

@ -13,8 +13,9 @@
<span class="svg-container"> <span class="svg-container">
<svg-icon icon-class="password"></svg-icon> <svg-icon icon-class="password"></svg-icon>
</span> </span>
<el-input name="password" type="password" @keyup.enter.native="handleLogin" v-model="loginForm.password" autoComplete="on" <el-input name="password" :type="pwdType" @keyup.enter.native="handleLogin" v-model="loginForm.password" autoComplete="on"
placeholder="password"></el-input> placeholder="password"></el-input>
<span class="show-pwd" @click="showPwd"><svg-icon icon-class="eye" /></span>
</el-form-item> </el-form-item>
<el-form-item> <el-form-item>
<el-button type="primary" style="width:100%;" :loading="loading" @click.native.prevent="handleLogin"> <el-button type="primary" style="width:100%;" :loading="loading" @click.native.prevent="handleLogin">
@ -58,10 +59,18 @@ export default {
username: [{ required: true, trigger: 'blur', validator: validateUsername }], username: [{ required: true, trigger: 'blur', validator: validateUsername }],
password: [{ required: true, trigger: 'blur', validator: validatePass }] password: [{ required: true, trigger: 'blur', validator: validatePass }]
}, },
loading: false loading: false,
pwdType: 'password'
} }
}, },
methods: { methods: {
showPwd() {
if (this.pwdType === 'password') {
this.pwdType = ''
} else {
this.pwdType = 'password'
}
},
handleLogin() { handleLogin() {
this.$refs.loginForm.validate(valid => { this.$refs.loginForm.validate(valid => {
if (valid) { if (valid) {
@ -154,6 +163,7 @@ export default {
font-size: 16px; font-size: 16px;
color: $dark_gray; color: $dark_gray;
cursor: pointer; cursor: pointer;
user-select:none;
} }
.thirdparty-button{ .thirdparty-button{
position: absolute; position: absolute;