Closed vexos-io closed 1 year ago
无法用表达式: ${selectedItems|pick:x.x}
但可以用:${selectedItems|json|toJson|pick:x.x}
请问是什么原因?
麻烦提供一下可复现问题的json
使用${selectedItems|pick:任何数据}都是无法成功的,转化为json再转回来就成功了
多谢关注,我猜测不是pick本身的问题,应该是【CRUD的selectedItems】有什么特殊的情况,因为对于同样的JSON,直接pick是没问题的
是我之前没有说清楚,你可以在这个网站 https://aisuda.github.io/amis-editor-demo/#/hello-world 上复现问题,并把生成的json代码发一下吗
{ "type": "page", "title": "Hello world", "body": [ { "type": "tpl", "tpl": "初始页面", "inline": false }, { "type": "crud", "api": "", "columns": [ { "name": "id", "label": "ID", "type": "text" }, { "name": "engine", "label": "渲染引擎", "type": "text" }, { "type": "operation", "label": "操作", "buttons": [ ] } ], "bulkActions": [ { "label": "PICK测试", "type": "button", "actionType": "ajax", "api": "/xxx/foo?bar=${selectedItems|pick:id|join:,}" } ], "itemActions": [ ], "features": [ "bulkDelete", "bulkUpdate" ], "perPageAvailable": [ 10 ], "messages": { }, "data": { "items": [ { "id": "101", "engine": "A" }, { "id": "102", "engine": "B" } ] } } ] }
以上代码的"PICK测试"按钮获取不到 ${selectedItems|pick:id|join:,}
好像试出来了,是items变量,不应该是selectedItems,求确认是不是这个原因
还是按照你之前的用法${selectedItems|json|toJson|pick:x.x}
吧,我们近期修复一下
好的,辛苦了,您来决定是否关闭这个issue吧
无法用表达式: ${selectedItems|pick:x.x}
但可以用:${selectedItems|json|toJson|pick:x.x}
请问是什么原因?