Skip to content
Snippets Groups Projects
PasswordInput.vue 708 B
Newer Older
  • Learn to ignore specific revisions
  • <template>
      <div class="ui action input">
        <input
        required
        :tabindex="index"
        :type="passwordInputType"
        @input="$emit('input', $event.target.value)"
        :value="value">
    
    Eliot Berriot's avatar
    Eliot Berriot committed
        <span @click="showPassword = !showPassword" :title="labels.title" class="ui icon button">
    
          <i class="eye icon"></i>
        </span>
      </div>
    </template>
    <script>
    export default {
      props: ['value', 'index'],
      data () {
        return {
          showPassword: false
        }
      },
      computed: {
    
    Eliot Berriot's avatar
    Eliot Berriot committed
        labels () {
          return {
            title: this.$gettext('Show/hide password')
          }
        },
    
        passwordInputType () {
          if (this.showPassword) {
            return 'text'
          }
          return 'password'
        }
      }
    }
    </script>