chore: eslint 配置
All checks were successful
/ depcheck (push) Successful in 2m19s
/ playwright (push) Successful in 1m45s
/ surge (push) Successful in 2m48s
/ build-and-deploy-to-vercel (push) Successful in 3m10s

This commit is contained in:
mini2024
2025-03-05 00:57:51 +08:00
parent feb7659b75
commit 2b7186ef69
35 changed files with 455 additions and 458 deletions

View File

@ -10,8 +10,8 @@ export const usePageData = defineBasicLoader(
return { idFromPreviousPage: route.params.id, someOtherData: 'someOtherData' };
},
{
lazy: false,
commit: 'immediate',
lazy: false,
// - `immediate`: the data is committed as soon as it is loaded.
// - `after-load`: the data is committed after all non-lazy loaders have finished loading.
// - `immediate`:数据在加载后立即提交。
@ -28,8 +28,8 @@ definePage({
});
const {
data: pageData, // the data returned by the loader
isLoading, // a boolean indicating if the loader is fetching data
error, // an error object if the loader failed
isLoading, // a boolean indicating if the loader is fetching data
reload, // a function to refetch the data without navigating
} = usePageData();

View File

@ -13,11 +13,11 @@ async function getUserById(userId: string, { signal }: { signal?: AbortSignal })
}
export const useUserData = defineColadaLoader('DataLoadersIdSub1UserId', {
key: (to) => ['users', to.params.userId],
async query(to, { signal }) {
console.debug('[defineColadaLoader] query');
return getUserById(to.params.userId, { signal });
},
key: (to) => ['users', to.params.userId],
// Keep the data "fresh" 10 seconds to avoid fetching the same data too often
// 保持数据“新鲜”10秒以避免过于频繁地获取相同的数据
staleTime: 1000 * 10,
@ -31,7 +31,7 @@ export const usePageData = defineBasicLoader('DataLoadersIdSub1UserId', async (r
</script>
<script setup lang="ts">
const { data: user, status, error, isLoading, reload, refresh } = useUserData();
const { data: user, error, isLoading, refresh, reload, status } = useUserData();
const route = useRoute('DataLoadersIdSub1UserId');
</script>