efa*_*ley 5 angular angular-schematics
在设置原理图时,我发现可以提示输入以下任何类型 String | 布尔 | 数组 | 数量 | 整数 | 空 | 目的。
我正在尝试设置一个示意图,提示用户从可用模块列表中选择一个模块。例如,用户会看到这样的内容:
What module are you adding this store to?
> Foo
Bar
Baz
Run Code Online (Sandbox Code Playgroud)
虽然有大量字符串和布尔提示的示例,但没有人提供我找到的数组提示的示例。对于我的一生,我无法弄清楚如何在数组中提供选项来提示用户进行选择,而这根本没有出现在他们的文档中。
{
"$schema": "http://json-schema.org/schema",
"id": "SchematicsIDXStoreGen",
"title": "IDX Store Gen Schema",
"type": "object",
"properties": {
"featureName": {
"type": "string",
"description": "The name of the store",
"x-prompt": "What is the name of the store you'd like to create"
},
"module": {
"type": "array",
"description": "Select the appropriate module",
"x-prompt": "What module are you adding this store to?" // I want to provide a list of available modules here.
}
},
"required": ["featureName", "module"]
}
Run Code Online (Sandbox Code Playgroud)
您可以尝试以下方法,也可以选择适合您的选项。
"modules": {
"type": "array",
"description": "description",
"uniqueItems": true,
"items": {
"type": "string"
},
"x-prompt": {
"message": "Which module would you like to select?",
"type": "list",
"multiselect": true,
"items": [
"firstOption",
"secondOption",
"thirdOption"
]
}
}Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1991 次 |
| 最近记录: |