目录

移除bindPopup弹窗的阴影效果

问题现象

如何移除bindPopup弹窗的阴影效果?

问题效果预览:

效果预览

背景知识

解决方案

通过配置ShadowOptions实现阴影效果的灵活控制。在ShadowOptions模式中,当满足radius设置为0时,即可实现无阴影效果。

@Entry
@Component
struct PopupExample {
  @State customPopup: boolean = false;

  build() {
    Column({ space: 100 }) {
      Button('popup')
        .margin({ top: 50 })
        .onClick(() => {
          this.customPopup = !this.customPopup;
        })
        .bindPopup(this.customPopup, {
          message: 'this is a popup',
          arrowHeight: 20,
          arrowWidth: 20,
          radius: 20,
          shadow: {
            radius: 0
          },
        });
    }
    .width('100%');
  }
}