es lint fix

This commit is contained in:
thofx
2023-07-22 16:09:07 +08:00
parent 48749b29fe
commit 018778488a
80 changed files with 3994 additions and 2981 deletions
+39 -30
View File
@@ -1,73 +1,82 @@
<script lang="ts" setup>
import api from "@/api";
import type { Subscribe } from "@/api/types";
import NoDataFound from "@/components/NoDataFound.vue";
import SubscribeCard from "@/components/cards/SubscribeCard.vue";
import PullRefresh from 'pull-refresh-vue3';
import PullRefresh from 'pull-refresh-vue3'
import api from '@/api'
import type { Subscribe } from '@/api/types'
import NoDataFound from '@/components/NoDataFound.vue'
import SubscribeCard from '@/components/cards/SubscribeCard.vue'
// 输入参数
const props = defineProps({
type: String,
});
})
// 是否刷新过
const isRefreshed = ref(false)
// 数据列表
const dataList = ref<Subscribe[]>([]);
const dataList = ref<Subscribe[]>([])
// 获取订阅列表数据
const fetchData = async () => {
async function fetchData() {
try {
dataList.value = await api.get("subscribe");
dataList.value = await api.get('subscribe')
isRefreshed.value = true
} catch (error) {
console.error(error);
}
};
catch (error) {
console.error(error)
}
}
// 加载时获取数据
onBeforeMount(fetchData);
onBeforeMount(fetchData)
// 刷新状态
const loading = ref(false);
const loading = ref(false)
// 下拉刷新
const onRefresh = () => {
loading.value = true;
fetchData();
loading.value = false;
};
function onRefresh() {
loading.value = true
fetchData()
loading.value = false
}
// 过滤数据
const filteredDataList = computed(() => {
return dataList.value.filter((data) => data.type === props.type);
});
return dataList.value.filter(data => data.type === props.type)
})
</script>
<template>
<VProgressCircular
class="centered"
v-if="!isRefreshed"
class="centered"
indeterminate
color="primary"
></VProgressCircular>
<PullRefresh v-model="loading" @refresh="onRefresh">
<div class="grid gap-3 grid-subscribe-card"
v-if="filteredDataList.length > 0">
<SubscribeCard v-for="data in filteredDataList" :key="data.id" :media="data" />
/>
<PullRefresh
v-model="loading"
@refresh="onRefresh"
>
<div
v-if="filteredDataList.length > 0"
class="grid gap-3 grid-subscribe-card"
>
<SubscribeCard
v-for="data in filteredDataList"
:key="data.id"
:media="data"
/>
</div>
<NoDataFound
v-if="filteredDataList.length === 0 && isRefreshed"
error-code="404"
error-title="没有订阅"
error-description="请通过搜索添加电影电视剧订阅"
>
</NoDataFound>
/>
</PullRefresh>
</template>
<style type="scss">
<style lang="scss">
.grid-subscribe-card {
grid-template-columns: repeat(auto-fill, minmax(20rem, 1fr));
padding-block-end: 1rem;