Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

关于 toolbox onclick 交互 #30

Closed
mcxinyu opened this issue Apr 8, 2020 · 3 comments
Closed

关于 toolbox onclick 交互 #30

mcxinyu opened this issue Apr 8, 2020 · 3 comments

Comments

@mcxinyu
Copy link

mcxinyu commented Apr 8, 2020

我想在 toolbox 中自定义按钮监听,可以让 flutter 获得点击事件通知么?

@entronad
Copy link
Owner

entronad commented Apr 9, 2020

可以,类似这个例子:

child: Echarts(

@mcxinyu
Copy link
Author

mcxinyu commented Apr 9, 2020

toolbox: {
  feature: {
    myTool1: {
      show: true,
      title: '按天统计',
      icon: 'image://http://image2.njf2016.com/%E6%97%A5.png',
      onclick: function () {
        alert('myToolHandler2')
      }
    },
    myTool2: {
      show: true,
      title: '按月统计',
      icon: 'image://http://image2.njf2016.com/%E6%9C%88.png',
      onclick: function () {
        alert('myToolHandler2')
      }
    }
  }
},

像这种我应该怎么写extraScript呢?谢谢

@entronad
Copy link
Owner

entronad commented Apr 9, 2020

把 alert 替换成 Messager.postMessage(message) ,然后在onMessage: (String message) {...} 处理message

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants