mirror of
https://github.com/BTMuli/TeyvatGuide.git
synced 2025-12-16 09:58:13 +08:00
🐛 修复 Qodana 报错
This commit is contained in:
@@ -15,7 +15,7 @@ interface TurAvatarGridProps {
|
||||
}
|
||||
|
||||
const props = defineProps<TurAvatarGridProps>();
|
||||
const data = computed(() => JSON.parse(<string>props.modelValue) as TGApp.Sqlite.Record.Avatar[]);
|
||||
const data = computed<TGApp.Sqlite.Record.Avatar[]>(() => JSON.parse(<string>props.modelValue));
|
||||
</script>
|
||||
<style lang="css" scoped>
|
||||
.tur-ag-box {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<template>
|
||||
<div v-if="props.modelValue === undefined">暂无数据</div>
|
||||
<div v-else class="tur-hg-box">
|
||||
<TurHomeSub v-for="home in homes" :data="home" />
|
||||
<TurHomeSub v-for="(home, index) in homes" :key="index" :data="home" />
|
||||
</div>
|
||||
</template>
|
||||
<script lang="ts" setup>
|
||||
@@ -14,11 +14,12 @@ interface TurHomeGridProps {
|
||||
}
|
||||
|
||||
const props = defineProps<TurHomeGridProps>();
|
||||
const homes = computed(() => {
|
||||
const res = JSON.parse(props.modelValue || "[]") as TGApp.Sqlite.Record.Home[];
|
||||
const homes = computed<TGApp.Sqlite.Record.Home[]>(() => {
|
||||
const res = JSON.parse(props.modelValue ?? "[]");
|
||||
if (res.length > 0) {
|
||||
return res;
|
||||
}
|
||||
return [];
|
||||
});
|
||||
</script>
|
||||
<style lang="css" scoped>
|
||||
|
||||
@@ -28,7 +28,7 @@ interface TurOverviewGridProps {
|
||||
}
|
||||
|
||||
const props = defineProps<TurOverviewGridProps>();
|
||||
const data = computed(() => JSON.parse(<string>props.modelValue) as TGApp.Sqlite.Record.Stats);
|
||||
const data = computed<TGApp.Sqlite.Record.Stats>(() => JSON.parse(<string>props.modelValue));
|
||||
</script>
|
||||
<style lang="css" scoped>
|
||||
.tur-og-box {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<template>
|
||||
<div v-if="props.modelValue === undefined">暂无数据</div>
|
||||
<div v-else class="tur-wg-box">
|
||||
<TurWorldSub v-for="area in getData()" :data="area" :theme="theme" />
|
||||
<TurWorldSub v-for="(area, index) in getData()" :key="index" :data="area" :theme="theme" />
|
||||
</div>
|
||||
</template>
|
||||
<script lang="ts" setup>
|
||||
@@ -23,8 +23,8 @@ const theme = computed(() => {
|
||||
}
|
||||
});
|
||||
|
||||
function getData() {
|
||||
return JSON.parse(<string>props.modelValue) as TGApp.Sqlite.Record.WorldExplore[];
|
||||
function getData(): TGApp.Sqlite.Record.WorldExplore[] {
|
||||
return JSON.parse(<string>props.modelValue);
|
||||
}
|
||||
</script>
|
||||
<style lang="css" scoped>
|
||||
|
||||
@@ -69,9 +69,9 @@ onMounted(async () => {
|
||||
: (getUrl.value.icon = getUrl.value.iconDark);
|
||||
});
|
||||
|
||||
async function listenOnTheme() {
|
||||
async function listenOnTheme(): Promise<void> {
|
||||
await event.listen("readTheme", (e) => {
|
||||
const theme = e.payload as string;
|
||||
const theme = <string>e.payload;
|
||||
if (theme === "dark") {
|
||||
getUrl.value.icon = getUrl.value.iconLight;
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user