组件如图

添加ts自定义脚本,定义onClickFunc点击方法:
TypeScript
import { Component, _decorator} from "cc";
const { ccclass } = _decorator;
@ccclass('RichTextComponent')
export class RichTextComponent extends Component{
public onClickFunc(event, param:string){
console.log("click me:", param);
}
}
RichText组件添加脚本文件:

大功告成,运行效果如图:
