mirror of
https://iceshrimp.dev/limepotato/jormungandr-bite.git
synced 2024-11-14 05:57:32 -07:00
refactor: use autofocus parameter
Using the `ref` seems to be broken but using the autofocus parameter seems to fix it.
This commit is contained in:
parent
95ca3ab718
commit
0af344b4e3
1 changed files with 1 additions and 14 deletions
|
@ -11,7 +11,7 @@
|
||||||
<div class="tbhwbxda">
|
<div class="tbhwbxda">
|
||||||
<div class="form">
|
<div class="form">
|
||||||
<FormSplit :min-width="170">
|
<FormSplit :min-width="170">
|
||||||
<MkInput ref="usernameEl" v-model="username" @update:modelValue="search">
|
<MkInput v-model="username" :autofocus="true" @update:modelValue="search">
|
||||||
<template #label>{{ $ts.username }}</template>
|
<template #label>{{ $ts.username }}</template>
|
||||||
<template #prefix>@</template>
|
<template #prefix>@</template>
|
||||||
</MkInput>
|
</MkInput>
|
||||||
|
@ -70,15 +70,8 @@ let host = $ref('');
|
||||||
let users: misskey.entities.UserDetailed[] = $ref([]);
|
let users: misskey.entities.UserDetailed[] = $ref([]);
|
||||||
let recentUsers: misskey.entities.UserDetailed[] = $ref([]);
|
let recentUsers: misskey.entities.UserDetailed[] = $ref([]);
|
||||||
let selected: misskey.entities.UserDetailed | null = $ref(null);
|
let selected: misskey.entities.UserDetailed | null = $ref(null);
|
||||||
let usernameEl: HTMLElement = $ref();
|
|
||||||
let dialogEl = $ref();
|
let dialogEl = $ref();
|
||||||
|
|
||||||
const focus = () => {
|
|
||||||
if (usernameEl) {
|
|
||||||
usernameEl.focus();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
const search = () => {
|
const search = () => {
|
||||||
if (username === '' && host === '') {
|
if (username === '' && host === '') {
|
||||||
users = [];
|
users = [];
|
||||||
|
@ -112,12 +105,6 @@ const cancel = () => {
|
||||||
};
|
};
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
focus();
|
|
||||||
|
|
||||||
nextTick(() => {
|
|
||||||
focus();
|
|
||||||
});
|
|
||||||
|
|
||||||
os.api('users/show', {
|
os.api('users/show', {
|
||||||
userIds: defaultStore.state.recentlyUsedUsers,
|
userIds: defaultStore.state.recentlyUsedUsers,
|
||||||
}).then(users => {
|
}).then(users => {
|
||||||
|
|
Loading…
Reference in a new issue