mirror of
https://github.com/BTMuli/TeyvatGuide.git
synced 2025-12-06 08:32:51 +08:00
🐛 修复成就页点击异常,调整UI
This commit is contained in:
@@ -46,10 +46,13 @@ interface TuaAchiListProps {
|
||||
hideFin: boolean;
|
||||
series?: number;
|
||||
search?: string;
|
||||
isSearch: boolean;
|
||||
}
|
||||
|
||||
interface TuaAchiListEmits {
|
||||
(e: "update:series", v: number): void;
|
||||
|
||||
(e: "update:isSearch", v: boolean): false;
|
||||
}
|
||||
|
||||
const props = defineProps<TuaAchiListProps>();
|
||||
@@ -72,17 +75,32 @@ const renderAchi = computed<Array<TGApp.Sqlite.Achievement.RenderAchi>>(() => {
|
||||
onMounted(async () => await loadAchi());
|
||||
|
||||
watch(
|
||||
() => [props.series, props.search, props.uid],
|
||||
() => [props.search, props.isSearch],
|
||||
async () => await searchAchi(),
|
||||
);
|
||||
|
||||
watch(
|
||||
() => [props.series, props.uid],
|
||||
async () => await loadAchi(),
|
||||
);
|
||||
|
||||
async function loadAchi(): Promise<void> {
|
||||
if (props.search && props.search !== "") {
|
||||
nameCard.value = undefined;
|
||||
ncData.value = undefined;
|
||||
achievements.value = await TSUserAchi.searchAchi(props.uid, props.search);
|
||||
async function searchAchi(): Promise<void> {
|
||||
if (!props.isSearch) return;
|
||||
if (!props.search || props.search === "") {
|
||||
showSnackbar.warn("请输入搜索内容");
|
||||
emits("update:isSearch", false);
|
||||
return;
|
||||
}
|
||||
nameCard.value = undefined;
|
||||
ncData.value = undefined;
|
||||
achievements.value = await TSUserAchi.searchAchi(props.uid, props.search);
|
||||
if (achievements.value.length > 0) {
|
||||
showSnackbar.success(`成功获取${achievements.value.length}条成就`);
|
||||
}
|
||||
emits("update:isSearch", false);
|
||||
}
|
||||
|
||||
async function loadAchi(): Promise<void> {
|
||||
achievements.value = await TSUserAchi.getAchievements(props.uid, props.series);
|
||||
if (!selectedAchi.value && achievements.value.length > 0) {
|
||||
selectedAchi.value = achievements.value[0];
|
||||
|
||||
@@ -128,7 +128,7 @@ const box = computed(() => {
|
||||
height: "128px",
|
||||
display: "inner",
|
||||
lt: `/icon/element/${data.value?.element}元素.webp`,
|
||||
ltSize: "40px",
|
||||
ltSize: "30px",
|
||||
innerHeight: 30,
|
||||
innerIcon: `/icon/weapon/${data.value?.weapon}.webp`,
|
||||
innerText: data.value?.name,
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
label="搜索"
|
||||
:hide-details="true"
|
||||
:single-line="true"
|
||||
@keydown.enter="isSearch = true"
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
@@ -46,6 +47,7 @@
|
||||
:hideFin="hideFin"
|
||||
v-model:series="selectedSeries"
|
||||
v-model:search="search"
|
||||
v-model:isSearch="isSearch"
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
@@ -74,6 +76,7 @@ import {
|
||||
} from "../../utils/UIAF.js";
|
||||
|
||||
const search = ref<string>("");
|
||||
const isSearch = ref<boolean>(false);
|
||||
const hideFin = ref<boolean>(false);
|
||||
|
||||
const uidList = ref<number[]>([]);
|
||||
|
||||
Reference in New Issue
Block a user