refresnLabel.ts 646 B

1234567891011121314151617181920212223
  1. import { _decorator, Component, Label, Node } from 'cc';
  2. const { ccclass, property } = _decorator;
  3. @ccclass('refresnLabel')
  4. export class refresnLabel extends Component {
  5. @property(Label)
  6. label:Label = null;
  7. protected start(): void {
  8. if(!this.label)
  9. {
  10. this.label = this.getComponent(Label);
  11. }
  12. }
  13. refreshInput(text, editbox, customEventData) {
  14. // 这里的 text 表示修改完后的 EditBox 的文本内容
  15. // 这里 editbox 是一个 EditBox 对象
  16. // 这里的 customEventData 参数就等于你之前设置的 "foobar"
  17. this.label.string = text;
  18. }
  19. }