Display warning pop-up component, which can set text content and response callback.

AlertDialog.show(value: AlertDialogParamWithConfirm | AlertDialogParamWithButtons | AlertDialogParamWithOptions)

AlertDialogParam object description
·Title: Pop up title.
·Subtitle: Pop up subtitle.
·Message: Pop up content.
·AutoCancel: Whether to close the pop-up window when clicking on the obstruction layer, true means to close the pop-up window. False means not closing the pop-up window. (Default value: true)
·Cancel: The callback when clicking on the blocking layer to close the dialog.
·Alignment: The vertical alignment of the pop-up window. (Default value: DialogAlignment.Default)
·Offset: The offset of the pop-up window relative to the position of the alignment. (Default value: { dx: 0 , dy: 0 })
·GridCount: The number of grids occupied by the width of the pop-up container. (Default value: 4, value range: integers greater than or equal to 0.)
·MaskRect: In the pop-up masking layer area, events within the masking layer area are not transparent, while events outside the masking layer area are transparent. (Default value: { x: 0, y: 0, width: '100%', height: '100%' })
·ShowInSubWindow: When a certain popup needs to be displayed outside the main window, should it be displayed in a sub window. (Default value: false, Pop ups are displayed within the application, rather than as separate child windows
·IsModal: Is the pop-up window a modal window? Modal windows have masks, while non modal windows have no masks. (Default value: true, At this moment, there is a mask on the pop-up window
·Background Color: The color of the pop-up panel. (Default value: Color.Transparent)
·BackBlurStyle: Pop up window back panel blurred material. (Default value: BlurStyle.COMPONENT_ULTRA_THICK)
·OnWillDismiss: interactively closes the callback function.
·CornerRadius: Set the corner radius of the backplate. You can set the radii of four rounded corners separately. (Default value: { topLeft: '32vp', topRight: '32vp', bottomLeft: '32vp', bottomRight: '32vp' }) The size of the rounded corner is limited by the size of the component, with a maximum value of half the width or height of the component. If the value is negative, it will be processed according to the default value. Percentage parameter method: Set the rounded corner of the popup based on the percentage of the parent element's popup width and height.
·Transition: Set the transition effect for pop-up display and exit.
·Width: Set the width of the pop-up panel.
·Height: Set the height of the pop-up panel.
·BorderWidth: Four border widths can be set separately. (Default value: 0) Percentage parameter method: Set the border width of the pop-up window as a percentage of the parent element's pop-up width. When the left and right borders of a pop-up window are larger than the width of the pop-up window, and the upper and lower borders of the pop-up window are larger than the height of the pop-up window, the display may not meet expectations.
·BorderColor: Set the border color of the pop-up panel. (Default value: Color. Black) If using the borderColor attribute, it needs to be used together with the borderWidth attribute.

Example demonstration: AlertDialogPage

@Entry
@Component
struct AlertDialogPage {
  @State message: string = 'AlertDialog';
  @State dialogMessage:string=''

  build() {
    Column({space:10}) {
      Text(this.message)
        .fontSize(20)
        .fontWeight(FontWeight.Bold)

      Button('点击弹窗').onClick(()=>{
        AlertDialog.show({
          title:'删除联系人',
          message:'是否删除所选的联系人',
          primaryButton:{
            value:'取消',
            action:()=>{
              //点击“取消”按钮的业务逻辑
              this.dialogMessage='点击了取消'
            }
          },
          secondaryButton:{
            value:'删除',
            fontColor:Color.Red,
            action:()=>{
              //点击“删除”按钮的业务逻辑
              this.dialogMessage='成功删除'
            }
          }
        })
      })

      Text('弹窗消息:'+this.dialogMessage)
    }
    .height('100%')
    .width('100%')
  }
}