12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485 |
- import { defineCollection, z } from '@nuxt/content'
-
- // 定义 Category 集合
- const categoryCollection = defineCollection({
- type: 'page',
- schema: z.object({
- title: z.string(),
- description: z.string().optional(),
- id: z.string(),
- image: z.string(),
- summary: z.string(),
- capacities: z.array(z.string()),
- sort: z.number(),
- tags: z.array(z.string()),
- audiences: z.array(z.string()),
- body: z.object({
- value: z.string()
- })
- })
- })
-
- // 定义 Product 集合
- const productCollection = defineCollection({
- type: 'page',
- schema: z.object({
- title: z.string(),
- name: z.string(),
- model: z.string(),
- description: z.string().optional(),
- id: z.string(),
- categoryId: z.string(), // 关联类别的ID
- usage: z.array(z.string()),
- series: z.array(z.string()),
- tag: z.array(z.string()),
- image: z.string(),
- gallery: z.array(z.string()),
- summary: z.string(),
- capacities: z.array(z.string()),
- sort: z.number(),
- body: z.object({
- value: z.string()
- })
- })
- })
-
- // 定义 Usage 集合
- const usageCollection = defineCollection({
- type: 'page',
- schema: z.object({
- title: z.string(),
- description: z.string(),
- id: z.string(),
- category: z.string(),
- products: z.array(z.string()),
- summary: z.string(),
- sort: z.number()
- })
- })
-
- // 定义 FAQ 集合
- const faqCollection = defineCollection({
- type: 'page',
- schema: z.object({
- title: z.string(),
- description: z.string().optional(),
- id: z.string(),
- category: z.string(),
- question: z.string(),
- answer: z.string(),
- sort: z.number()
- })
- })
-
- // 定义默认集合
- const defaultCollection = defineCollection({
- type: 'page'
- })
-
- export default {
- categories: categoryCollection,
- products: productCollection,
- usages: usageCollection,
- faq: faqCollection,
- content: defaultCollection
- }
|