import { _decorator, Component, Label, Node } from 'cc'; const { ccclass, property } = _decorator; @ccclass('toast') export class toast extends Component { @property(Node) lab_text:Node = null; public show(text:string){ this.lab_text.getComponent(Label).string = text; this.scheduleOnce(()=>{ this.node.removeFromParent() },1) } }