From 6a47636f8cc995647701b09e26a99448859c6304 Mon Sep 17 00:00:00 2001 From: meixiaogang1 Date: Mon, 10 Oct 2022 17:47:52 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0Loading?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- entry/src/main/ets/Components/LoadingView.ets | 31 +++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 entry/src/main/ets/Components/LoadingView.ets diff --git a/entry/src/main/ets/Components/LoadingView.ets b/entry/src/main/ets/Components/LoadingView.ets new file mode 100644 index 0000000..c6ae0bf --- /dev/null +++ b/entry/src/main/ets/Components/LoadingView.ets @@ -0,0 +1,31 @@ + +@Component +export default struct LoadingView { + private animTasker + @State rotateAngle: number = 0 + + aboutToAppear() { + this.animTasker = setInterval(() => { + this.rotateAngle = ((this.rotateAngle == 360) ? 0 : (this.rotateAngle + 1)) + }, 10) + } + + aboutToDisappear() { + clearInterval(this.animTasker) + } + + build() { + Stack({ alignContent: Alignment.Center }) { + Image($r('app.media.ic_loading')) + .width('50px') + .height('50px') + .objectFit(ImageFit.Fill) + .rotate({ + z: 1, + centerX: '50%', + centerY: '50%', + angle: this.rotateAngle, + }) + }.width('100%').height('100%').backgroundColor('#00000000') + } +} \ No newline at end of file -- Gitee