HarmonyOSBaseLibs/src/main/ets/view/SwipeView.ets

35 行
959 B
Plaintext

2025-05-22 18:58:14 +08:00
@Component
export struct SwipeView {
@State h: Length = 40
@Builder
doNothingBuilder() {
}
@BuilderParam customBuilderParam: () => void = this.doNothingBuilder
// @BuilderParam btnBuilder: () => void = this.doNothingBuilder
build() {
Scroll() {
Row() {
this.customBuilderParam()
Text('删除')
.backgroundColor('red')
.width(70)
.fontColor('white')
.height(this.h)
.textAlign(TextAlign.Center)
.fontSize(16)
// if (this.btnBuilder === this.doNothingBuilder) {
// Text('删除')
// }
// if (this.btnBuilder !== this.doNothingBuilder) {
// this.btnBuilder()
// }
}.onSizeChange((oldValue: SizeOptions, newValue: SizeOptions) => {
this.h = newValue.height ?? 40
}).alignItems(VerticalAlign.Center)
}.width('100%').scrollable(ScrollDirection.Horizontal).scrollBar(BarState.Off)
}
}