cocos creator Richtext点击事件

组件如图

添加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组件添加脚本文件:

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

相关推荐
We་ct3 小时前
LeetCode 56. 合并区间:区间重叠问题的核心解法与代码解析
前端·算法·leetcode·typescript
程序猿阿伟12 小时前
《TypeScript中Protobuf到运行时类型安全的转换指南》
javascript·安全·typescript
We་ct13 小时前
LeetCode 228. 汇总区间:解题思路+代码详解
前端·算法·leetcode·typescript
阿蒙Amon1 天前
TypeScript学习-第10章:模块与命名空间
学习·ubuntu·typescript
小李也疯狂1 天前
Unity 中的立方体贴图(Cubemaps)
unity·游戏引擎·贴图·cubemap
呆呆敲代码的小Y1 天前
【Unity工具篇】| 超实用工具LuBan,快速上手使用
游戏·unity·游戏引擎·unity插件·luban·免费游戏·游戏配置表
EQ-雪梨蛋花汤1 天前
【Unity优化】Unity多场景加载优化与资源释放完整指南:解决Additive加载卡顿、预热、卸载与内存释放问题
unity·游戏引擎
我的offer在哪里1 天前
用 Unity 从 0 做一个「可以玩的」游戏,需要哪些步骤和流程
游戏·unity·游戏引擎
泡泡茶壶ᐇ1 天前
Unity游戏开发入门指南:从零开始理解游戏引擎核心概念
unity·游戏引擎
Var_al1 天前
抖小Unity WebGL分包命令行工具实践指南
unity·游戏引擎·webgl