Hanye官网
Ви не можете вибрати більше 25 тем Теми мають розпочинатися з літери або цифри, можуть містити дефіси (-) і не повинні перевищувати 35 символів.

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. import { defineCollection, z } from '@nuxt/content'
  2. // 定义 Category 集合
  3. const categoryCollection = defineCollection({
  4. type: 'page',
  5. schema: z.object({
  6. title: z.string(),
  7. description: z.string().optional(),
  8. id: z.string(),
  9. image: z.string(),
  10. summary: z.string(),
  11. capacities: z.array(z.string()),
  12. sort: z.number(),
  13. tags: z.array(z.string()),
  14. audiences: z.array(z.string()),
  15. body: z.object({
  16. value: z.string()
  17. })
  18. })
  19. })
  20. // 定义 Product 集合
  21. const productCollection = defineCollection({
  22. type: 'page',
  23. schema: z.object({
  24. title: z.string(),
  25. name: z.string(),
  26. model: z.string(),
  27. description: z.string().optional(),
  28. id: z.string(),
  29. categoryId: z.string(), // 关联类别的ID
  30. usage: z.array(z.string()),
  31. series: z.array(z.string()),
  32. tag: z.array(z.string()),
  33. image: z.string(),
  34. gallery: z.array(z.string()),
  35. summary: z.string(),
  36. capacities: z.array(z.string()),
  37. sort: z.number(),
  38. body: z.object({
  39. value: z.string()
  40. })
  41. })
  42. })
  43. // 定义 Usage 集合
  44. const usageCollection = defineCollection({
  45. type: 'page',
  46. schema: z.object({
  47. title: z.string(),
  48. description: z.string(),
  49. id: z.string(),
  50. category: z.string(),
  51. products: z.array(z.string()),
  52. summary: z.string(),
  53. sort: z.number()
  54. })
  55. })
  56. // 定义 FAQ 集合
  57. const faqCollection = defineCollection({
  58. type: 'page',
  59. schema: z.object({
  60. title: z.string(),
  61. description: z.string().optional(),
  62. id: z.string(),
  63. category: z.string(),
  64. question: z.string(),
  65. answer: z.string(),
  66. sort: z.number()
  67. })
  68. })
  69. // 定义默认集合
  70. const defaultCollection = defineCollection({
  71. type: 'page'
  72. })
  73. export default {
  74. categories: categoryCollection,
  75. products: productCollection,
  76. usages: usageCollection,
  77. faq: faqCollection,
  78. content: defaultCollection
  79. }