perf: reset value after reopen LockScreenModal (#4269)
* perf: replace deprecated @keypress with @keydown for Enter key handling * perf: reset value after reopen LockScreenModalpull/48/MERGE
parent
3b2ed948f5
commit
88a7a9b1ee
|
@ -34,15 +34,22 @@ const emit = defineEmits<{
|
||||||
submit: RegisterEmits['submit'];
|
submit: RegisterEmits['submit'];
|
||||||
}>();
|
}>();
|
||||||
|
|
||||||
|
const formState = reactive({
|
||||||
|
lockScreenPassword: '',
|
||||||
|
submitted: false,
|
||||||
|
});
|
||||||
|
|
||||||
const [Modal] = useVbenModal({
|
const [Modal] = useVbenModal({
|
||||||
onConfirm() {
|
onConfirm() {
|
||||||
handleSubmit();
|
handleSubmit();
|
||||||
},
|
},
|
||||||
});
|
onOpenChange(isOpen) {
|
||||||
|
if (isOpen) {
|
||||||
const formState = reactive({
|
// reset value reopen
|
||||||
lockScreenPassword: '',
|
formState.submitted = false;
|
||||||
submitted: false,
|
formState.lockScreenPassword = '';
|
||||||
|
}
|
||||||
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
const passwordStatus = computed(() => {
|
const passwordStatus = computed(() => {
|
||||||
|
@ -70,7 +77,7 @@ function handleSubmit() {
|
||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
class="mb-10 flex w-full flex-col items-center px-10"
|
class="mb-10 flex w-full flex-col items-center px-10"
|
||||||
@keypress.enter.prevent="handleSubmit"
|
@keydown.enter.prevent="handleSubmit"
|
||||||
>
|
>
|
||||||
<div class="w-full">
|
<div class="w-full">
|
||||||
<div class="ml-2 flex w-full flex-col items-center">
|
<div class="ml-2 flex w-full flex-col items-center">
|
||||||
|
|
|
@ -120,7 +120,7 @@ function toggleUnlockForm() {
|
||||||
<div
|
<div
|
||||||
v-if="showUnlockForm"
|
v-if="showUnlockForm"
|
||||||
class="flex-center size-full"
|
class="flex-center size-full"
|
||||||
@keypress.enter.prevent="handleSubmit"
|
@keydown.enter.prevent="handleSubmit"
|
||||||
>
|
>
|
||||||
<div class="flex-col-center mb-10 w-[300px]">
|
<div class="flex-col-center mb-10 w-[300px]">
|
||||||
<VbenAvatar :src="avatar" class="enter-x mb-6 size-20" />
|
<VbenAvatar :src="avatar" class="enter-x mb-6 size-20" />
|
||||||
|
|
Loading…
Reference in New Issue