🐛 修复 Qodana 报错

This commit is contained in:
BTMuli
2023-07-29 14:15:26 +08:00
parent d1fa7348c8
commit 062e34e585
31 changed files with 216 additions and 162 deletions

View File

@@ -11,7 +11,11 @@
/>
</div>
<div class="toc-material-grid">
<TibCalendarMaterial v-for="item in itemVal.materials" :item="item" />
<TibCalendarMaterial
v-for="(item, index) in itemVal.materials"
:key="index"
:item="item"
/>
</div>
</div>
<img src="/source/UI/item-line.webp" alt="line" class="toc-line" />
@@ -48,7 +52,7 @@ import TibCalendarItem from "../itembox/tib-calendar-item.vue";
import TibCalendarMaterial from "../itembox/tib-calendar-material.vue";
// utils
import { createTGWindow } from "../../utils/TGWindow";
//plugins
// plugins
import Mys from "../../plugins/Mys";
interface ToCalendarProps {
@@ -67,18 +71,20 @@ const props = defineProps<ToCalendarProps>();
const visible = computed({
get: () => props.modelValue,
set: (value) => emits("update:modelValue", value),
set: (value) => {
emits("update:modelValue", value);
},
});
const itemType = computed(() => props.dataType);
const itemVal = computed<TGApp.App.Calendar.Item>(() => props.dataVal);
const snackbar = ref<boolean>(false);
const onCancel = () => {
const onCancel = (): void => {
visible.value = false;
emits("cancel");
};
function toDetail(item: TGApp.App.Calendar.Item) {
function toDetail(item: TGApp.App.Calendar.Item): void {
if (item.contentId === 0) {
snackbar.value = true;
return;

View File

@@ -4,7 +4,12 @@
<div class="toc-top">
<div class="toc-title">请选择要跳转的频道</div>
<div class="toc-list">
<div v-for="item in channelList" class="toc-list-item" @click="toChannel(item.link)">
<div
v-for="(item, index) in channelList"
:key="index"
class="toc-list-item"
@click="toChannel(item.link)"
>
<img :src="item.icon" alt="icon" />
<span>{{ item.title }}</span>
</div>
@@ -28,9 +33,7 @@ interface ToChannelProps {
modelValue: boolean;
}
interface ToChannelEmits {
(e: "update:modelValue", value: boolean): void;
}
type ToChannelEmits = (e: "update:modelValue", value: boolean) => void;
interface ToChannelItem {
title: string;
@@ -45,7 +48,9 @@ const emits = defineEmits<ToChannelEmits>();
const visible = computed({
get: () => props.modelValue,
set: (value) => emits("update:modelValue", value),
set: (value) => {
emits("update:modelValue", value);
},
});
const router = useRouter();
@@ -87,13 +92,15 @@ const channelList: ToChannelItem[] = [
},
];
function onCancel() {
function onCancel(): void {
visible.value = false;
}
function toChannel(link: string) {
async function toChannel(link: string): Promise<void> {
visible.value = false;
router.push(link);
await router.push(link).then(() => {
window.scrollTo(0, 0);
});
setTimeout(() => {
window.location.reload();
}, 300);