mirror of
https://github.com/PaiGramTeam/luoxu-api-pub.git
synced 2024-11-22 15:37:25 +00:00
use keydown instead of keyup to watch Enter; trigger search on group change
keyup receives keys from after IME
This commit is contained in:
parent
79ac1e1c69
commit
11e44dabc3
@ -101,6 +101,13 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async function on_group_change() {
|
||||||
|
error = ''
|
||||||
|
if(query) {
|
||||||
|
await do_search()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
async function do_search_more() {
|
async function do_search_more() {
|
||||||
const more = result.messages[result.messages.length-1].t
|
const more = result.messages[result.messages.length-1].t
|
||||||
const old_msgs = result.messages
|
const old_msgs = result.messages
|
||||||
@ -114,7 +121,7 @@
|
|||||||
|
|
||||||
<main>
|
<main>
|
||||||
<div id="searchbox">
|
<div id="searchbox">
|
||||||
<select bind:value={group} on:change={() => error = ''}>
|
<select bind:value={group} on:change={on_group_change}>
|
||||||
{#each groups as group}
|
{#each groups as group}
|
||||||
<option value={group.group_id}>{group.name}</option>
|
<option value={group.group_id}>{group.name}</option>
|
||||||
{:else}
|
{:else}
|
||||||
@ -123,7 +130,7 @@
|
|||||||
</select>
|
</select>
|
||||||
<input type="search" bind:value={query}
|
<input type="search" bind:value={query}
|
||||||
on:input={() => error = ''}
|
on:input={() => error = ''}
|
||||||
on:keyup={e => {if(e.key == 'Enter'){do_search()}}}
|
on:keydown={e => {if(e.key == 'Enter'){do_search()}}}
|
||||||
/>
|
/>
|
||||||
<button on:click={() => do_search()}>搜索</button>
|
<button on:click={() => do_search()}>搜索</button>
|
||||||
</div>
|
</div>
|
||||||
|
Loading…
Reference in New Issue
Block a user