mirror of
https://iceshrimp.dev/limepotato/jormungandr-bite.git
synced 2024-11-22 01:47:39 -07:00
[client] Fix search page behavior in windows
This commit is contained in:
parent
ed6d5d2db6
commit
51065dd170
1 changed files with 8 additions and 6 deletions
|
@ -104,9 +104,11 @@ import "swiper/scss";
|
||||||
import "swiper/scss/virtual";
|
import "swiper/scss/virtual";
|
||||||
import {instance} from "@/instance";
|
import {instance} from "@/instance";
|
||||||
import MkSearch from "@/components/MkSearch.vue";
|
import MkSearch from "@/components/MkSearch.vue";
|
||||||
import { mainRouter } from "@/router.js";
|
import { useRouter } from "@/router.js";
|
||||||
import * as os from "@/os.js";
|
import * as os from "@/os.js";
|
||||||
|
|
||||||
|
const router = useRouter();
|
||||||
|
|
||||||
const getUrlParams = () =>
|
const getUrlParams = () =>
|
||||||
window.location.search
|
window.location.search
|
||||||
.substring(1)
|
.substring(1)
|
||||||
|
@ -194,12 +196,12 @@ async function search(query: string) {
|
||||||
const q = query.trim();
|
const q = query.trim();
|
||||||
|
|
||||||
if (q.startsWith("@") && !q.includes(" ")) {
|
if (q.startsWith("@") && !q.includes(" ")) {
|
||||||
mainRouter.push(`/${q}`);
|
router.push(`/${q}`);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (q.startsWith("#")) {
|
if (q.startsWith("#")) {
|
||||||
mainRouter.push(`/tags/${encodeURIComponent(q.slice(1))}`);
|
router.push(`/tags/${encodeURIComponent(q.slice(1))}`);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -213,15 +215,15 @@ async function search(query: string) {
|
||||||
const res = await promise;
|
const res = await promise;
|
||||||
|
|
||||||
if (res.type === "User") {
|
if (res.type === "User") {
|
||||||
mainRouter.push(`/@${res.object.username}@${res.object.host}`);
|
router.push(`/@${res.object.username}@${res.object.host}`);
|
||||||
} else if (res.type === "Note") {
|
} else if (res.type === "Note") {
|
||||||
mainRouter.push(`/notes/${res.object.id}`);
|
router.push(`/notes/${res.object.id}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
searchQuery = q;
|
searchQuery = q;
|
||||||
mainRouter.push(`/search?q=${encodeURIComponent(q)}`);
|
router.push(`/search?q=${encodeURIComponent(q)}`);
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
Loading…
Reference in a new issue