Choose list

用于存储不同对象元素列表的字段

choose-list 类型的字段用于存储不同类型的对象列表。例如,如果你的页面有以下结构:

blocks:
  - type: title
    text: 这是标题 # This is the title
  - type: content
    body: 这是内容 # This is the content

使用 choose-list 字段可以在 CMS 中添加、删除和重新排序这些元素:

{
  name: "blocks",
  type: "choose-list",
  fields: [
    {
      name: "title",
      type: "object",
      fields: [
        "text: text"
      ]
    },
    {
      name: "content",
      type: "object",
      fields: [
        "body: markdown"
      ]
    },
  ]
}

可用选项

此字段仅接受来自通用选项nametypelabeldescription 选项。它还接受以下额外的选项:

fields

一个不同字段(大多数情况下是 object 字段)的列表,这些字段可供选择。字段的 name 用于存储每个项的 type 属性。