alpacajs - 如何创建数据源以从相同形式的数据数组中进行选择?
问题描述
我想在羊驼形式中制作选择字段,它以相同的形式从其他数组中获取数据。
无法从文档中理解它是如何制作的
解决方案
{"schema":{
"properties":{
"selectedEventType":{
"type":"number",
"title":"Event Type"
}
}
}
和...
{"options":{
"fields":{
"selectedEventType":{
"type": "select",
"dataSource": "/mycontroller/options/event",
"removeDefaultNone": true,
"helper": "list of selectable options"
}
}
}
在 (/mycontroller/options/event) 的 REST api 中返回如下所示的数据:
{[ {"text":"one","value":1},{"text":"two","value":2},{"text":"three","value":3} ]}
推荐阅读
- php - PHP Composer 不会报告选择跳过某个包版本的原因。为什么/如何改变?
- docker - 如何使用 C# 以编程方式从 Azure 函数启动和运行 docker 容器?
- python - 流式传输时,additional_bq_parameters 作为可调用对象不起作用?
- reactjs - 尝试从对象值呈现 div
- python - Django - 将所需的自动生成的“uuid4”添加到现有项目中
- javascript - 如何使用 javascript 基于按钮单击选择兄弟 div?
- javascript - Javascript更改移动上下文菜单
- dom-events - 为每个添加的任务添加一个删除按钮
- graphql-spqr - 如何处理 GraphQL SPQR 中的身份字段
- r - R anti_join 只保留一个数据帧中的行