fix: 锁屏和解锁密码输入框自动聚焦
This commit is contained in:
parent
32051e9ca0
commit
4e264c503a
@ -27,7 +27,8 @@ const emit = defineEmits<{
|
|||||||
submit: [Recordable<any>];
|
submit: [Recordable<any>];
|
||||||
}>();
|
}>();
|
||||||
|
|
||||||
const [Form, { resetForm, validate, getValues }] = useVbenForm(
|
const [Form, { resetForm, validate, getValues, getFieldComponentRef }] =
|
||||||
|
useVbenForm(
|
||||||
reactive({
|
reactive({
|
||||||
commonConfig: {
|
commonConfig: {
|
||||||
hideLabel: true,
|
hideLabel: true,
|
||||||
@ -49,7 +50,7 @@ const [Form, { resetForm, validate, getValues }] = useVbenForm(
|
|||||||
]),
|
]),
|
||||||
showDefaultActions: false,
|
showDefaultActions: false,
|
||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
|
|
||||||
const [Modal] = useVbenModal({
|
const [Modal] = useVbenModal({
|
||||||
onConfirm() {
|
onConfirm() {
|
||||||
@ -60,6 +61,13 @@ const [Modal] = useVbenModal({
|
|||||||
resetForm();
|
resetForm();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
onOpened() {
|
||||||
|
requestAnimationFrame(() => {
|
||||||
|
getFieldComponentRef('lockScreenPassword')
|
||||||
|
?.$el?.querySelector('[name="lockScreenPassword"]')
|
||||||
|
?.focus();
|
||||||
|
});
|
||||||
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
async function handleSubmit() {
|
async function handleSubmit() {
|
||||||
|
|||||||
@ -37,7 +37,7 @@ const date = useDateFormat(now, 'YYYY-MM-DD dddd', { locales: locale.value });
|
|||||||
const showUnlockForm = ref(false);
|
const showUnlockForm = ref(false);
|
||||||
const { lockScreenPassword } = storeToRefs(accessStore);
|
const { lockScreenPassword } = storeToRefs(accessStore);
|
||||||
|
|
||||||
const [Form, { form, validate }] = useVbenForm(
|
const [Form, { form, validate, getFieldComponentRef }] = useVbenForm(
|
||||||
reactive({
|
reactive({
|
||||||
commonConfig: {
|
commonConfig: {
|
||||||
hideLabel: true,
|
hideLabel: true,
|
||||||
@ -75,6 +75,13 @@ async function handleSubmit() {
|
|||||||
|
|
||||||
function toggleUnlockForm() {
|
function toggleUnlockForm() {
|
||||||
showUnlockForm.value = !showUnlockForm.value;
|
showUnlockForm.value = !showUnlockForm.value;
|
||||||
|
if (showUnlockForm.value) {
|
||||||
|
requestAnimationFrame(() => {
|
||||||
|
getFieldComponentRef('password')
|
||||||
|
?.$el?.querySelector('[name="password"]')
|
||||||
|
?.focus();
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
useScrollLock();
|
useScrollLock();
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user