chore: eslint 配置
This commit is contained in:
@ -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();
|
||||
|
||||
|
@ -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>
|
||||
|
Reference in New Issue
Block a user