Created
April 23, 2018 15:59
-
-
Save larizzatg/b29b97a5480e196fa5a88919923e4bac to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<template> | |
<div> | |
<app-input | |
:label="label" | |
:type="type" | |
prepend-content="lock" | |
:append-content="passwordIcon" | |
:append-inside="true" | |
:append-pointer="true" | |
@click-append="tooglePassword" | |
:value="value" | |
@input="inputEvent"> | |
</app-input> | |
</div> | |
</template> | |
<script> | |
import Input from './Input'; | |
export default { | |
name: 'Password', | |
components: { | |
appInput: Input, | |
}, | |
props: { | |
value: String, | |
label: { | |
type: String, | |
default: 'Contraseña', | |
}, | |
readonly: { | |
type: Boolean, | |
default: false, | |
}, | |
disabled: { | |
type: Boolean, | |
default: false, | |
}, | |
valid: { | |
type: Boolean, | |
default: null, | |
}, | |
}, | |
data() { | |
return { | |
pass: '', | |
type: 'password', | |
}; | |
}, | |
computed: { | |
passwordIcon() { | |
return this.type === 'password' ? 'eye' : 'eye-slash'; | |
}, | |
}, | |
methods: { | |
tooglePassword() { | |
this.type = this.type === 'password' ? 'text' : 'password'; | |
}, | |
inputEvent(e) { | |
this.$emit('input', e.target.value); | |
}, | |
}, | |
}; | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment