add query feature

This commit is contained in:
Zhang Minghan 2023-08-02 12:04:19 +08:00
parent b264247d16
commit 2d931d4938

View File

@ -32,12 +32,18 @@ function refreshScrollbar() {
onMounted(() => {
if (!inputEl.value) return;
const param = new URLSearchParams(window.location.search);
const message = param.get("q");
if (message) {
input.value = message.trim();
window.history.replaceState({}, "", window.location.pathname);
send();
}
inputEl.value.focus();
(inputEl.value as HTMLElement).addEventListener("keydown", async (e) => {
if (e.key === "Enter") await send();
});
});
</script>
<template>