chore: 调整目录结构

- 将Directus相关的组合式API移入composables/direcuts
This commit is contained in:
2025-10-16 14:56:46 +08:00
parent cb861bc955
commit 202657e634
4 changed files with 5 additions and 0 deletions

View File

@ -0,0 +1,22 @@
export const useDirectusFiles = () => {
const config = useRuntimeConfig();
const baseUrl = config.public.directus.url;
const getFileUrl = (
id?: string | null,
options?: Record<string, string | number | boolean>
): string => {
if (!id) return '';
const query = options
? '?' +
new URLSearchParams(
Object.entries(options).map(([key, value]) => [key, String(value)])
).toString()
: '';
return `${baseUrl}/assets/${id}${query}`;
};
return {
getFileUrl,
};
};