后台脚手架上的下拉控件(或单选按钮)



我正在后台架子工中创建一个模板,我需要一种方法向用户展示一个选项选择UI,它可以是下拉选择或一组单选按钮,类似于

Name of your project ______
Include foo [ ]
CSS Processor |v|
- None
- SASS
- Stylus

我找不到如何做精选部分。文档中唯一存在的下拉列表是Repository Picker,但它是一个自定义控件,除此之外,我只能找到type: stringtype: boolean的示例。事实上,type: array有一些东西,但这个例子似乎不完整(或者这种类型不适合我想要的(

是否可以不使用自定义组件?

最终我通过解决了这个问题

parameters:
- title: My scaffolder
properties:
...
includeRequester:
title: Include an API requester?
type: string
description: Should this module include an API requester? (REST or GraphQL)
default: none
enum:
- none
- rest
- graphql

然而,我不知道如何定义选项的标签。理想情况下,我想到了类似的东西

none: Don't include a requester
rest: Include a REST requester
graphql: Include a GraphQL requester

但还好,尽管没有标签,但它还是按预期工作。

根据当前文档,我认为您的解决方案如下所示:

parameters:
- title: My scaffolder
properties:
...
includeRequester:
title: Include an API requester?
type: string
description: Should this module include an API requester? (REST or GraphQL)
default: none
enum:
- none
- rest
- graphql
enumNames:
- 'Don't include a requester'
- 'Include a REST requester'
- 'Include a GraphQL requester'

相关内容

  • 没有找到相关文章

最新更新