Skip to content

Commit 647647c

Browse files
autofocus when prompted
1 parent a4446c3 commit 647647c

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

src/msgbox.vue

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -259,14 +259,16 @@
259259
if (this.$type === 'prompt') {
260260
this.validate();
261261
}
262-
}
263-
},
262+
},
264263
265-
ready() {
266-
if (this.$type === 'prompt') {
267-
setTimeout(() => {
268-
this.$els.input.focus();
269-
}, 500);
264+
visible(val) {
265+
if (val && this.$type === 'prompt') {
266+
setTimeout(() => {
267+
if (this.$els.input) {
268+
this.$els.input.focus();
269+
}
270+
}, 500);
271+
}
270272
}
271273
},
272274

0 commit comments

Comments
 (0)