From 67a57048adcd4ec20112587d1340f4bbd12a72cc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BE=90=E5=8B=A4=E6=B0=91?= Date: Thu, 22 May 2025 18:58:14 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A4=87=E4=BB=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Index.ets | 1 + src/main/ets/view/SwipeView.ets | 35 +++++++++++++++++++++++++++++++++ 2 files changed, 36 insertions(+) create mode 100644 src/main/ets/view/SwipeView.ets diff --git a/Index.ets b/Index.ets index cf3b649..9680c88 100644 --- a/Index.ets +++ b/Index.ets @@ -57,6 +57,7 @@ export { WindowHelper } from './src/main/ets/utils/WindowHelper' export { LoadingView } from './src/main/ets/view/LoadingView' export { SafeView } from './src/main/ets/view/SafeView' export { RefreshView } from './src/main/ets/view/refresh/RefreshView' +export { SwipeView } from './src/main/ets/view/SwipeView' /** * 自定义view */ diff --git a/src/main/ets/view/SwipeView.ets b/src/main/ets/view/SwipeView.ets new file mode 100644 index 0000000..c5d9b1b --- /dev/null +++ b/src/main/ets/view/SwipeView.ets @@ -0,0 +1,35 @@ +@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) + } +} \ No newline at end of file