baidu / baidu/amis

chart组件toolbox自定义事件无法绑定函数

Open
#7,339 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

confirmed feat help wanted
Dominant language
TypeScript
Stars
18.9k
Forks
2.7k
PR merge metrics
No merged PRs in 30d

Description

描述问题:

在使用chart组件时,自定义toolbox的feature无法绑定事件。

截图或视频:
image
如何复现(请务必完整填写下面内容):
  1. 你是如何使用 amis 的?
    sdknpm

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

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

{
  "type": "page",
  "body": {
    "type": "chart",
    "api": "/amis/api/mock2/chart/chartData",
    "config": {
      "toolbox": {
        "show": true,
        "feature": {
          "myDownload": {
            "show": true,
            "title": "数据导出",
            "icon": "image://https://echarts.apache.org/zh/images/favicon.png",
            "onclick": "function () { alert(\"need help\");}"
          }
        }
      },
      "xAxis": {
        "type": "category",
        "data": [
          "Mon",
          "Tue",
          "Wed",
          "Thu",
          "Fri",
          "Sat"
        ]
      },
      "yAxis": {
        "type": "value"
      },
      "series": [
        {
          "data": "${line || []}",
          "type": "line"
        }
      ]
    }
  }
}
  1. 操作步骤
    无需其他操作,直接就会报错

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the issue with the provided amis chart schema and its custom toolbox feature, then trace the chart component's handling of the toolbox configuration and onclick value. Done means the myDownload feature binds its custom handler without an error and triggers the expected alert when selected.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.