请问为什么我的richtext click事件触发不了

按照文档中加了一个richtext

但是js代码不知道怎么监听这个handler事件,看到很多帖子,好像直接加一个函数叫handler就可以了

但是触发不了。
于是,我
this.node.on(“click”, this.handler) // 不行
this.node.on(“handler”, this.handler) // 不行
cc.find(“richtext”, this.node).on(“click”, this.handler) // 不行
cc.find(“richtext”, this.node).on(“handler”, this.handler) // 不行
我还加了全局函数叫handler,也调用不到
不知道js该如何才能监听到,请赐教。我的版本是2.0.10

代码所在脚本需要作为组件,挂到 RichText节点

加一个Button组件上去才能监听点击事件

不需要添加button的

click事件要的,touch事件不需要

用了 richText drawcall好高 大家有什么办法降低吗?

可以了,谢谢

请问您你是怎么样可以的

真机可以吗?

我讲下我的 RichText 的 click 事件注册
1 richText.string = <on click="handler"> click me! </on>;
2 声明一个脚本 event.ts , 实现方法 handler
3 RichText 组件节点加上 Button 组件和 events.ts 脚本

1赞

简单实现,不需要挂button