@@ -27,29 +27,30 @@ const emit = defineEmits<{
2727 submit: [Recordable <any >];
2828}>();
2929
30- const [Form, { resetForm, validate, getValues }] = useVbenForm (
31- reactive ({
32- commonConfig: {
33- hideLabel: true ,
34- hideRequiredMark: true ,
35- },
36- schema: computed (() => [
37- {
38- component: ' VbenInputPassword' as const ,
39- componentProps: {
40- placeholder: $t (' ui.widgets.lockScreen.placeholder' ),
41- },
42- fieldName: ' lockScreenPassword' ,
43- formFieldProps: { validateOnBlur: false },
44- label: $t (' authentication.password' ),
45- rules: z
46- .string ()
47- .min (1 , { message: $t (' ui.widgets.lockScreen.placeholder' ) }),
30+ const [Form, { resetForm, validate, getValues, getFieldComponentRef }] =
31+ useVbenForm (
32+ reactive ({
33+ commonConfig: {
34+ hideLabel: true ,
35+ hideRequiredMark: true ,
4836 },
49- ]),
50- showDefaultActions: false ,
51- }),
52- );
37+ schema: computed (() => [
38+ {
39+ component: ' VbenInputPassword' as const ,
40+ componentProps: {
41+ placeholder: $t (' ui.widgets.lockScreen.placeholder' ),
42+ },
43+ fieldName: ' lockScreenPassword' ,
44+ formFieldProps: { validateOnBlur: false },
45+ label: $t (' authentication.password' ),
46+ rules: z
47+ .string ()
48+ .min (1 , { message: $t (' ui.widgets.lockScreen.placeholder' ) }),
49+ },
50+ ]),
51+ showDefaultActions: false ,
52+ }),
53+ );
5354
5455const [Modal] = useVbenModal ({
5556 onConfirm() {
@@ -60,6 +61,13 @@ const [Modal] = useVbenModal({
6061 resetForm ();
6162 }
6263 },
64+ onOpened() {
65+ requestAnimationFrame (() => {
66+ getFieldComponentRef (' lockScreenPassword' )
67+ ?.$el ?.querySelector (' [name="lockScreenPassword"]' )
68+ ?.focus ();
69+ });
70+ },
6371});
6472
6573async function handleSubmit() {
0 commit comments