Hanye官网
Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

content.config.ts 1.7KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  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. })
  15. })
  16. // 定义 Product 集合
  17. const productCollection = defineCollection({
  18. type: 'page',
  19. schema: z.object({
  20. title: z.string(),
  21. name: z.string(),
  22. description: z.string().optional(),
  23. id: z.string(),
  24. categoryId: z.string(), // 关联类别的ID
  25. usage: z.array(z.string()),
  26. series: z.array(z.string()),
  27. tag: z.array(z.string()),
  28. image: z.string(),
  29. gallery: z.array(z.string()),
  30. summary: z.string(),
  31. capacities: z.array(z.string()),
  32. sort: z.number(),
  33. body: z.object({
  34. value: z.string()
  35. })
  36. })
  37. })
  38. // 定义 Usage 集合
  39. const usageCollection = defineCollection({
  40. type: 'page',
  41. schema: z.object({
  42. title: z.string(),
  43. description: z.string(),
  44. id: z.string(),
  45. category: z.string(),
  46. products: z.array(z.string()),
  47. summary: z.string(),
  48. sort: z.number()
  49. })
  50. })
  51. // 定义 FAQ 集合
  52. const faqCollection = defineCollection({
  53. type: 'page',
  54. schema: z.object({
  55. title: z.string(),
  56. description: z.string().optional(),
  57. id: z.string(),
  58. category: z.string(),
  59. question: z.string(),
  60. answer: z.string(),
  61. sort: z.number()
  62. })
  63. })
  64. // 定义默认集合
  65. const defaultCollection = defineCollection({
  66. type: 'page'
  67. })
  68. export default {
  69. categories: categoryCollection,
  70. products: productCollection,
  71. usages: usageCollection,
  72. faq: faqCollection,
  73. content: defaultCollection
  74. }