如何指定点击回调?

问题描述 投票:0回答:1

我有描述按钮的界面:

export interface IButtonConfig {
  text: string,
  class: string,
  click?: any
}

我需要将click属性设置为回调,才能像这样使用它:

click(cb) {
  cb();
}
 click(data => {
     // get Callback result here
})

该怎么做?

typescript typescript2.0
1个回答
0
投票

[您在第二批代码中有两个不同的签名(示例用法)。

© www.soinside.com 2019 - 2024. All rights reserved.