
回复
自定义builder后即可修改高度
@Entry
@Component
struct Index {
@State handlePopup: boolean = false
@Builder
buildPopup(){
Text("请输入100的整数倍")
.backgroundColor(Color.Orange)
.fontColor(Color.White)
.fontSize(20)
.height(100)
}
build() {
Column() {
Row() {
}
.width(200)
.height(50)
.backgroundColor('#C0C0C0')
.onClick(() => {
this.handlePopup = !this.handlePopup;
})
.bindPopup(this.handlePopup,{
builder:this.buildPopup
})
}.width('100%').height('100%').justifyContent(FlexAlign.Center)
}
}
修改popup和组件之间的距离targetSpace
@Entry
@Component
struct Index {
@State handlePopup: boolean = false
build() {
Column() {
Row() {
}
.width(200)
.height(50)
.backgroundColor('#C0C0C0')
.onClick(() => {
this.handlePopup = !this.handlePopup;
})
.bindPopup(this.handlePopup, {
message: '请输入100的整数倍',
messageOptions: { font: { size: 15 }, textColor: '#FFF' },
radius: 4,
placement: Placement.Top,
popupColor: '#FC6329',
showInSubWindow: false,
backgroundBlurStyle: BlurStyle.NONE,
targetSpace:80//设置Popup与目标的间距。不支持设置百分比。默认值:8单位:vp
})
}.width('100%').height('100%').justifyContent(FlexAlign.Center)
}
}