baidu / amis

前端低代码框架,通过 JSON 配置就能生成各种页面。
https://baidu.github.io/amis/
Apache License 2.0
16.47k stars 2.4k forks source link

crud组件切换外观-卡片或列表,行点击事件无效 #10521

Closed xiukun closed 8 hours ago

xiukun commented 5 days ago

描述问题:

crud组件右侧面板切换到外观-卡片或列表,行点击事件无效 我在行点击创建自定义js 输出console 无任何显示。

截图或视频:

如何复现(请务必完整填写下面内容):

{ "type": "crud", "syncLocation": false, "api": { "method": "get", "url": "https://mock.apipark.cn/m1/3546534-2258203-default/common/list", "requestAdaptor": "", "adaptor": "", "messages": {} }, "headerToolbar": [ "bulkActions" ], "bulkActions": [], "id": "u:e187e3b43ebf", "filterSettingSource": [ "name", "age", "date", "id", "address", "enable", "image", "imageList", "imgsList" ], "perPageAvailable": [ 10 ], "messages": {}, "mode": "list", "onEvent": { "rowClick": { "weight": 0, "actions": [ { "ignoreError": false, "script": "\nconsole.log(event,'eeee..')\n", "actionType": "custom" } ] } }, "listItem": { "body": [ { "label": "name", "type": "text", "name": "name", "id": "u:f7a8bbae4f3f" }, { "label": "age", "type": "text", "name": "age", "id": "u:b8ea88142a5b" }, { "label": "date", "type": "text", "name": "date", "id": "u:1b86cc6fc9b1" }, { "label": "id", "type": "text", "name": "id", "id": "u:ebf4a8fafe78" }, { "label": "address", "type": "text", "name": "address", "id": "u:beb8051c92db" }, { "label": "enable", "type": "text", "name": "enable", "id": "u:69d196be0ee0" }, { "label": "image", "type": "text", "name": "image", "id": "u:0310bd6ea050" }, { "label": "imageList", "type": "text", "name": "imageList", "id": "u:9e95ba68d3cf" }, { "label": "imgsList", "type": "text", "name": "imgsList", "id": "u:9653aedf15eb" } ], "actions": [], "id": "u:1c6bd7f0babd" } }

  1. 你是如何使用 amis 的? sdknpm其他...

  2. amis 版本是什么?请先在最新 beta 版本测试问题是否存在

  3. 粘贴有问题的完整 amis schema 代码:

    code here...
  4. 操作步骤 请简单描述一下复现的操作步骤...

CheshireJCat commented 8 hours ago

暂不支持 rowClick 这个事件,只有table中会row这个概念,因此只对table生效, 卡片模式和列表模式需要设置 itemAction 来定义点击事件, 列表参考:https://aisuda.bce.baidu.com/amis/zh-CN/components/list#%E5%8D%95%E8%A1%8C%E7%82%B9%E5%87%BB%E6%93%8D%E4%BD%9C 卡片参考:https://aisuda.bce.baidu.com/amis/zh-CN/components/card#%E7%82%B9%E5%87%BB%E5%8D%A1%E7%89%87%E7%9A%84%E8%A1%8C%E4%B8%BA