Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Cards 卡片组itemAction中拿不到上层作用域中的数据 #8457

Open
yinlianghui opened this issue Oct 22, 2023 · 0 comments
Open

Cards 卡片组itemAction中拿不到上层作用域中的数据 #8457

yinlianghui opened this issue Oct 22, 2023 · 0 comments

Comments

@yinlianghui
Copy link
Contributor

描述问题:

Crud中的card模式,或者Cards 卡片组的基本用法中为card配置itemAction时,无法取到上层作用域中的数据,只能取到当前item的数据。
以下两个amis官网示例都能重现此问题。
https://aisuda.bce.baidu.com/amis/zh-CN/components/crud#cards-%E5%8D%A1%E7%89%87%E6%A8%A1%E5%BC%8F
https://aisuda.bce.baidu.com/amis/zh-CN/components/cards?page=1#%E5%9F%BA%E6%9C%AC%E7%94%A8%E6%B3%95

截图或视频:

image

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

  1. 你是如何使用 amis 的?
    sdk

  2. amis 版本是什么?请先在最新 beta 版本测试问题是否存在
    skd三个版本2.9.0,3.2.0,3.4.1都有此问题。

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

{
  "type": "page",
  "data":{
    "x": "xxxxx"
  },
  "body": {
    "type": "crud",
    "api": "/amis/api/mock2/crud/users",
    "syncLocation": false,
    "mode": "cards",
    "defaultParams": {
      "perPage": 6
    },
    "switchPerPage": false,
    "placeholder": "没有用户信息",
    "columnsCount": 2,
    "card": {
      "header": {
        "className": "bg-white",
        "title": "$name",
        "subTitle": "$realName",
        "description": "$email",
        "avatar": "${avatar | raw}",
        "highlight": "$isSuperAdmin",
        "avatarClassName": "pull-left thumb-md avatar b-3x m-r"
      },
      "itemAction":{
            "actionType": "link",
            "link": "/app/${x}/${x}/view/${x}"
      },
      "bodyClassName": "padder"
    }
  }
}
  1. 操作步骤
    把上面完整的amis schema 代码,放到amis官网示例中,点击列表项就可以看到页面跳转了,但是跳转后的url中并没有正确取到page.data中的数据。
# for free to join this conversation on GitHub. Already have an account? # to comment
Projects
None yet
Development

No branches or pull requests

1 participant