1, 先看效果
2, 直接cv代码
import web_webview from '@ohos.web.webview';
interface PerUrl {
url: string,
age: number
}
@Component
export struct webviews {
controller: web_webview.WebviewController = new web_webview.WebviewController();
ports: web_webview.WebMessagePort[] = [];
@State
progressValue: number = 0
@State
progressIsVisible: Visibility = Visibility.None;
@Link
sonUrl:PerUrl
build() {
Column() {
Progress({ value: 0, total: 100, type: ProgressType.Linear })
.backgroundColor(0xFFFFFF)
.color(0x414AFF)
.value(this.progressValue)
.width('%100')
.height(2)
// .visibility(this.progressIsVisible)
.visibility(this.progressValue!=100 ? Visibility.Visible : Visibility.None)
Web({ src: this.sonUrl.url, controller: this.controller})
.onProgressChange((event) => {
if (event) {
console.log('newProgress:' + event.newProgress);
this.progressValue = event.newProgress
// if (this.progressValue === 100) {
// this.progressIsVisible = Visibility.None
// }else {
// this.progressIsVisible = Visibility.Visible
// }
}
})
}
}
}
标签:web,进度条,progressIsVisible,Visibility,event,Progress,webview,progressValue
From: https://blog.csdn.net/qq_52602294/article/details/141026449