Files
jinshen-website/app/composables/directus/useSolutionList.ts
R2m1liA 0363a88785
All checks were successful
deploy to server / build-and-deploy (push) Successful in 3m1s
feat: 解决方案列表页标签排序
- 为SolutionType添加Sort字段用于排序
- 解决方案列表按照sort升序排序
2025-11-08 15:46:37 +08:00

39 lines
919 B
TypeScript

import { readItems } from '@directus/sdk';
export const useSolutionList = () => {
const { $directus } = useNuxtApp();
const { getDirectusLocale } = useLocalizations();
const locale = getDirectusLocale();
return useAsyncData(`solution-list-${locale}`, async () => {
return await $directus.request(
readItems('solutions', {
fields: [
'id',
'cover',
{
type: ['id', { translations: ['id', 'name'] }, 'sort'],
},
{
translations: ['id', 'title', 'summary'],
},
],
deep: {
type: {
translations: {
_filter: {
languages_code: { _eq: locale },
},
},
},
translations: {
_filter: {
languages_code: { _eq: locale },
},
},
},
})
);
});
};