如何为角度示意图输入数组类型值

时间:2019-04-08 06:31:20

标签: json angular-schematics

我正在学习Angular Schematics,并且对数组类型输入遇到一些问题。

按Enter键后,该值便消失了。我可以知道如何输入数组值吗?

enter image description here

我在写 schema.json 如下

{
    "$schema": "http://json-schema.org/schema",
    "id": "HelloWorldSchematics",
    "title": "Hello World Options Schema",
    "type": "object",
    "properties": {
      "listName": {
        "type": "string",
        "description": "The name of the list.",
        "$default": {
          "$source": "argv",
          "index": 0
        },
        "x-prompt": "What's the name of list"
      },
      "colNames": {
        "type": "array",
        "items": {
            "type": "string"
        },
        "description": "The name of the columns.",
        "x-prompt": "What's the name of columns"
      }
    },
    "required": [
        "listName",
        "colNames"
    ]
}

1 个答案:

答案 0 :(得分:0)

我只能使用标志输入一个值。按照您的示例,您可以输入如下值:

schematics ./collection.json:HelloWorld --listName User --colNames={id,firstName}

请注意,数组元素之间没有空格

以下无效

schematics ./collection.json:HelloWorld --listName User --colNames={id, firstName}