PhotoBrowserDialog.ets
666 字节
@CustomDialog
export default struct PhotoBrowser {
controller: CustomDialogController = new CustomDialogController({builder: ''})
@State count: number = 0
@Prop imagesList: ResourceStr[] | string[] = []
build() {
Swiper(){
ForEach(this.imagesList, (str: string | ResourceStr, index)=>{
Image(str)
.width('100%')
.height('100%')
.objectFit(ImageFit.Auto)
})
}
.index(this.count)
.loop(false)
.backgroundColor(Color.Black)
.indicator(
new DotIndicator().color(Color.White)
)
.width('100%')
.height('100%')
.onClick(()=>{
this.controller.close()
})
}
}