Skip to content

Instantly share code, notes, and snippets.

@larizzatg
Created April 23, 2018 15:59
Show Gist options
  • Save larizzatg/b29b97a5480e196fa5a88919923e4bac to your computer and use it in GitHub Desktop.
Save larizzatg/b29b97a5480e196fa5a88919923e4bac to your computer and use it in GitHub Desktop.
<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