mirror of
https://github.com/BTMuli/TeyvatGuide.git
synced 2025-12-15 09:48:14 +08:00
✨ 添加帖子ID输入
This commit is contained in:
@@ -26,6 +26,17 @@
|
|||||||
variant="outlined"
|
variant="outlined"
|
||||||
label="排序"
|
label="排序"
|
||||||
/>
|
/>
|
||||||
|
<v-text-field
|
||||||
|
v-model="search"
|
||||||
|
class="post-switch-item"
|
||||||
|
append-inner-icon="mdi-magnify"
|
||||||
|
label="请输入帖子 ID"
|
||||||
|
variant="outlined"
|
||||||
|
:single-line="true"
|
||||||
|
hide-details
|
||||||
|
@click:append="searchPost"
|
||||||
|
@keyup.enter="searchPost"
|
||||||
|
/>
|
||||||
<v-btn class="post-fresh-btn" @click="freshPostData">
|
<v-btn class="post-fresh-btn" @click="freshPostData">
|
||||||
<v-icon>mdi-refresh</v-icon>
|
<v-icon>mdi-refresh</v-icon>
|
||||||
<span>刷新</span>
|
<span>刷新</span>
|
||||||
@@ -100,6 +111,7 @@
|
|||||||
import { computed, nextTick, onMounted, ref, watch } from "vue";
|
import { computed, nextTick, onMounted, ref, watch } from "vue";
|
||||||
|
|
||||||
import showConfirm from "../../components/func/confirm";
|
import showConfirm from "../../components/func/confirm";
|
||||||
|
import showSnackbar from "../../components/func/snackbar";
|
||||||
import ToLoading from "../../components/overlay/to-loading.vue";
|
import ToLoading from "../../components/overlay/to-loading.vue";
|
||||||
import Mys from "../../plugins/Mys";
|
import Mys from "../../plugins/Mys";
|
||||||
import { useAppStore } from "../../store/modules/app";
|
import { useAppStore } from "../../store/modules/app";
|
||||||
@@ -210,6 +222,7 @@ const curSortType = ref<number>(0);
|
|||||||
// 渲染数据
|
// 渲染数据
|
||||||
const posts = ref<TGApp.Plugins.Mys.Forum.RenderCard[]>([]);
|
const posts = ref<TGApp.Plugins.Mys.Forum.RenderCard[]>([]);
|
||||||
const nav = ref<TGApp.BBS.Navigator.Navigator[]>([]);
|
const nav = ref<TGApp.BBS.Navigator.Navigator[]>([]);
|
||||||
|
const search = ref<string>();
|
||||||
|
|
||||||
onMounted(async () => {
|
onMounted(async () => {
|
||||||
loading.value = true;
|
loading.value = true;
|
||||||
@@ -267,6 +280,25 @@ function freshCurForum(newVal: string): void {
|
|||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
curForum.value = forum[newVal];
|
curForum.value = forum[newVal];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 查询帖子
|
||||||
|
function searchPost(): void {
|
||||||
|
if (search.value === undefined || search.value === "") {
|
||||||
|
showSnackbar({
|
||||||
|
text: "请输入搜索内容",
|
||||||
|
color: "error",
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!isNaN(Number(search.value))) {
|
||||||
|
createPost(search.value);
|
||||||
|
} else {
|
||||||
|
showSnackbar({
|
||||||
|
text: "请输入搜索内容",
|
||||||
|
color: "error",
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
<style lang="css" scoped>
|
<style lang="css" scoped>
|
||||||
.posts-box {
|
.posts-box {
|
||||||
|
|||||||
Reference in New Issue
Block a user