40 lines
1.0 KiB
Vue
40 lines
1.0 KiB
Vue
<script setup lang="ts">
|
|
import { ref } from "vue";
|
|
import {
|
|
Button,
|
|
InputGroup,
|
|
InputGroupInput,
|
|
InputGroupSuffix,
|
|
Label,
|
|
TextField,
|
|
} from "@heroui-vue/components";
|
|
import { IconEye, IconEyeOff } from "@tabler/icons-vue";
|
|
|
|
const isVisible = ref(false);
|
|
</script>
|
|
|
|
<template>
|
|
<TextField class="w-full max-w-[280px]" name="password">
|
|
<Label>密码</Label>
|
|
<InputGroup>
|
|
<InputGroupInput
|
|
class="w-full max-w-[280px]"
|
|
:model-value="isVisible ? '87$2h.3diua' : '••••••••'"
|
|
:type="isVisible ? 'text' : 'password'"
|
|
/>
|
|
<InputGroupSuffix class="pe-0">
|
|
<Button
|
|
is-icon-only
|
|
:aria-label="isVisible ? '隐藏密码' : '显示密码'"
|
|
size="sm"
|
|
variant="ghost"
|
|
@click="isVisible = !isVisible"
|
|
>
|
|
<IconEyeOff v-if="isVisible" class="size-4" aria-hidden="true" />
|
|
<IconEye v-else class="size-4" aria-hidden="true" />
|
|
</Button>
|
|
</InputGroupSuffix>
|
|
</InputGroup>
|
|
</TextField>
|
|
</template>
|