Panel 组件的遮罩区域能否配置为不生效?

如题:Panel 组件的遮罩区域能否配置为不生效?

阅读 486
1 个回答

伙伴期望:Panel 存在时,未被 Panel 覆盖的区域,仍然可以交互。稍作修改后,并未发现 未被 Panel 覆盖的区域不能交互的情况,请伙伴在真机上测试一下

示例代码

@Entry
@Component
struct PanelExample {
  @State show: boolean = false
  @State message : string = "Hello World"
  @State i : number = 0;
  build() {
    Column() {
      Text(this.message)
        .width('90%')
        .height(50)
        .borderRadius(10)
        .backgroundColor(0xFFFFFF)
        .padding({ left: 20 })
        .onClick(() => {
          this.show = !this.show
        })
      Button("TEST+1")
        .onClick(()=>{
          this.i++;
          this.message = "Hello World chick number:" + this.i
        })
      Panel(this.show) { // 展示日程
        Column() {
          Text('Today Calendar')
          Divider()
          Text('1. afternoon 4:00 The project meeting')
        }
      }
      .type(PanelType.Minibar)
      .mode(PanelMode.Half)
      .dragBar(true) // 默认开启
      .halfHeight(500) // 默认一半
      .showCloseIcon(true) // 显示关闭图标
      .onChange((width: number, height: number, mode: PanelMode) => {
        console.info(`width:${width},height:${height},mode:${mode}`)
      })
    }.width('100%').height('100%').backgroundColor(0xDCDCDC).padding({ top: 5 })
  }
}

参考链接

PanelDemo

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进