mirror of
https://github.com/louislam/uptime-kuma.git
synced 2025-07-30 18:19:00 -04:00
Added component HiddenInput.vue
This commit is contained in:
parent
cc351b2883
commit
edfaacbb5f
2 changed files with 61 additions and 2 deletions
59
src/components/HiddenInput.vue
Normal file
59
src/components/HiddenInput.vue
Normal file
|
@ -0,0 +1,59 @@
|
|||
<template>
|
||||
<div class="input-group mb-3">
|
||||
<input v-model="model" :type="visibility" class="form-control" :placeholder="placeholder" :maxlength="maxlength" :autocomplete="autocomplete" :required="required">
|
||||
<a v-if="visibility == 'password'" class="btn btn-outline-primary" @click="showInput()">
|
||||
<font-awesome-icon icon="eye" />
|
||||
</a>
|
||||
<a v-if="visibility == 'text'" class="btn btn-outline-primary" @click="hideInput()">
|
||||
<font-awesome-icon icon="eye-slash" />
|
||||
</a>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
props: {
|
||||
modelValue: {
|
||||
type: String,
|
||||
default: ""
|
||||
},
|
||||
placeholder: {
|
||||
type: String,
|
||||
default: ""
|
||||
},
|
||||
maxlength: {
|
||||
type: Number,
|
||||
default: 255
|
||||
},
|
||||
autocomplete: {
|
||||
type: Boolean,
|
||||
},
|
||||
required: {
|
||||
type: Boolean
|
||||
},
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
visibility: "password"
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
model: {
|
||||
get() {
|
||||
return this.modelValue
|
||||
},
|
||||
set(value) {
|
||||
this.$emit('update:modelValue', value)
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
showInput() {
|
||||
this.visibility = "text";
|
||||
},
|
||||
hideInput() {
|
||||
this.visibility = "password";
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
Loading…
Add table
Add a link
Reference in a new issue