外部网址图片,配置module.json5
1"requestPermissions": [ 2 { 3 "name": "ohos.permission.INTERNET" 4 } 5],
1aboutToAppear(): void { 2 setTimeout(() => { 3 router.replaceUrl({ 4 url: 'pages/Index' 5 }) 6 }, 3000) 7}
1import { BasicConstants } from '../constants/BasicConstants'; 2import { router } from '@kit.ArkUI' 3 4@Entry 5@Component 6struct Page02_GuidePage { 7 @State message: string = 'Hello World'; 8 @State count: number = 3 9 private timer: number = 0 10 11 aboutToAppear(): void { 12 this.timer = setInterval(() => { 13 this.count-- 14 if (this.count == 0) { 15 router.replaceUrl({ 16 url: 'pages/Index' 17 }) 18 } 19 }, 1000) 20 } 21 22 aboutToDisappear(): void { 23 clearInterval(this.timer) 24 } 25 26 build() { 27 Stack({ 28 alignContent: Alignment.TopEnd 29 }) { 30 Text(`倒计时:${this.count}`) 31 .margin({ 32 right: 10 33 }) 34 Flex({ 35 direction: FlexDirection.Column, 36 alignItems: ItemAlign.Center 37 }) { 38 // logo 39 Column() { 40 Image($r('app.media.bird')) 41 .width(200) 42 .borderRadius(10) 43 } 44 .justifyContent(FlexAlign.Center) 45 .alignItems(HorizontalAlign.Center) 46 .flexGrow(1) 47 48 Image($r('app.media.startIcon')) 49 .width(28) 50 .objectFit(ImageFit.Contain) 51 52 Text('WoniuMall超市') 53 .fontColor('#66000000') 54 .fontSize(20) 55 .letterSpacing(16) 56 .margin({ 57 top: 12, 58 bottom: 136 59 }) 60 } 61 .width(BasicConstants.FULL_WIDTH) 62 .height(BasicConstants.FULL_HEIGHT) 63 } 64 } 65}
Copyright ©2010-2022 比特日记 All Rights Reserved.
Powered By 可尔物语