css - 如何使用 Angular json 模式表单创建多个表单选项卡?

标签 css angular angular-schema-form

我已经成功地使用了这个很棒的库和称为 json 模式形式的概念。

https://www.npmjs.com/package/angular2-json-schema-form

现在使用给定的模式模式,我能够基于从数据库动态创建的模式生成表单。我想在多个选项卡中转换单个表单。 I.E 我想在一个面板中对某些类型的字段进行分组。

此功能是否有任何类型的支持?这样我就可以根据布局分配 css 类。

https://angular2-json-schema-form.firebaseapp.com/?set=ng-jsf&example=ng-jsf-flex-layout&framework=material-design&language=en

最佳答案

您可以使用 fieldsets 属性将一组字段拆分为单独的选项卡。 请参阅 README.md 中的以下示例:

{
  "properties": {
    "firstName": {
      "type": "string",
      "description": "First name"
    },
    "lastName": {
      "type": "string",
      "description": "Last name"
    },
    "email": {
      "type": "string",
      "description": "Email"
    },
    "notificationsFrequency": {
      "type": "string",
      "description": "Notifications frequency",
      "widget": "select",
      "oneOf": [
        {
          "description": "Daily",
          "enum": [
            "daily"
          ]
        },
        {
          "description": "Weekly",
          "enum": [
            "weekly"
          ]
        },
        {
          "description": "Monthly",
          "enum": [
            "monthly"
          ]
        }
      ],
      "default": "daily"
    }
  },
  "fieldsets": [
    {
      "title": "Personal information",
      "fields": [
        "firstName",
        "lastName",
        "email"
      ]
    },
    {
      "title": "Account settings",
      "fields": [
        "notificationsFrequency"
      ]
    }
  ]
}

关于css - 如何使用 Angular json 模式表单创建多个表单选项卡?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48686624/

相关文章:

angularjs - schemaform 将用户输入添加到模式数组

javascript - 如何使用 CSS 覆盖 HTML 图像

html - Div 内的 Div 100% 高度不起作用

html - Bootstrap 卡内联 block

javascript - 如何在 ng2-pdf-viewer 上突出显示synctex输出值

node.js - 如何从 Firebase 的云功能获取 strip 付款费用 'success'?

javascript - 如何创建交换具有不同 ID 的 div 的函数?

node.js - 如何在 Bookshelf js 中使用 groupBy?

Angular-6-JSON 架构形式错误 : Nested Arrays getControl error: Unable to find "0" item in FormGroup

angular-schema-form - 如何预处理 AngularJS 模式表单的模型值