1212121212

import { emitter } from '@kit.BasicServicesKit';

@CustomDialog
struct CustomDialogExample {
  @State sign: number = 100
  controller: CustomDialogController = new CustomDialogController({
    builder: CustomDialogExample(),
  })
  aa: () => void = () => {
  }

  cancel() {
    console.log('23')
    this.controller1.stopEditing();
  }

  @State text: string = ''
  @State positionInfo: CaretOffset = { index: 0, x: 0, y: 0 }
  controller1: TextAreaController = new TextAreaController()

  aboutToAppear() {
    emitter.on({ eventId: 1, priority: emitter.EventPriority.LOW }, () => {
      console.log('999')
      this.sign = 100
    })
  }

  build() {
    Column() {
      TextArea({
        text: this.text,
        placeholder: 'The text area can hold an unlimited amount of text. input your word...',
        controller: this.controller1
      })
        .placeholderFont({ size: 16, weight: 400 })
        .width(336)
        .height(50)
        .fontSize(16)
        .fontColor('#182431')
        .backgroundColor('#FFFFFF')
        .onChange((value: string) => {
          this.text = value
        })
        .onFocus(() => {
          this.sign = 300
        })

      Button('dian').onClick(() => {
        this.sign = 300
      })
      Button('dian').onClick(() => {
        this.sign = 100
      })
    }.height(this.sign).backgroundColor('#ff23f60e')
  }
}

@Entry
@Preview
@Component
struct Index {
  @State message: string = 'Hello World';
  dialogController: CustomDialogController = new CustomDialogController({
    alignment: DialogAlignment.Bottom,
    autoCancel: false,
    cancel: () => {
      console.log('888')
      // emitter.emit({
      //   eventId: 1,
      //   priority: emitter.EventPriority.LOW
      // }, { data: {} });
    },
    offset: { dx: 0, dy: 0 },
    builder: CustomDialogExample({
      aa: () => {
        this.aa()
      }
    }),
  })

  aa() {
    console.log('1212121')
  }

  aboutToAppear() {
    this.dialogController.open();
  }

  build() {
    Column() {
      Column() {
      }.width('100%').height('40').backgroundColor('#ff1df307')

      Column() {
      }.width('100%').height('calc(100% - 140vp)').backgroundColor('#ff224385')

      Column() {
      }.width('100%').height('100').backgroundColor('#ff1df307')
    }.width("100%").height("100%").backgroundColor('red')
  }
}


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值