diff options
| author | Hamidreza Ghavami <hamid.r.gh.1998@gmail.com> | 2023-05-08 17:51:58 +0300 |
|---|---|---|
| committer | Hamidreza Ghavami <hamid.r.gh.1998@gmail.com> | 2023-05-08 17:51:58 +0300 |
| commit | f553922d5363fe63dd485f8cbaa7f56178a640cc (patch) | |
| tree | 538411f00cff66cdd309a7f8845be48b2715e733 /web | |
| parent | 7b2764566c010aabb2b21dde200d0021fffb409d (diff) | |
add password component
Diffstat (limited to 'web')
| -rw-r--r-- | web/html/xui/component/password.html | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/web/html/xui/component/password.html b/web/html/xui/component/password.html new file mode 100644 index 00000000..ebea3be6 --- /dev/null +++ b/web/html/xui/component/password.html @@ -0,0 +1,35 @@ +{{define "component/passwordInput"}} +<template> + <a-input :value="value" :type="showPassword ? 'text' : 'password'" + :placeholder="placeholder" + @input="$emit('input', $event.target.value)"> + <template v-if="icon" #prefix> + <a-icon :type="icon" :style="'font-size: 16px;' + themeSwitcher.textStyle" /> + </template> + <template #addonAfter> + <a-icon :type="showPassword ? 'eye-invisible' : 'eye'" + @click="toggleShowPassword" + :style="'font-size: 16px;' + themeSwitcher.textStyle" /> + </template> + </a-input> +</template> +{{end}} + +{{define "component/password"}} +<script> + Vue.component('password-input', { + props: ["title", "value", "placeholder", "icon"], + template: `{{template "component/passwordInput"}}`, + data() { + return { + showPassword: false, + }; + }, + methods: { + toggleShowPassword() { + this.showPassword = !this.showPassword; + }, + }, + }); +</script> +{{end}}
\ No newline at end of file |
