|
@@ -15,6 +15,7 @@ import { SZYXLocalStorageKeys } from '../utils/SZYXLocalStorageKeys';
|
|
|
export struct XWebview {
|
|
|
// 手机号
|
|
|
@State url?: string = (router.getParams() as XWebParams).url
|
|
|
+ @State zoomAccess?: boolean = (router.getParams() as XWebParams).zoomAccess
|
|
|
@State content?: string = (router.getParams() as XWebParams).content
|
|
|
@State title?: string = (router.getParams() as XWebParams).title
|
|
|
@State closeTag?: string = (router.getParams() as XWebParams).closeTag
|
|
@@ -122,7 +123,7 @@ export struct XWebview {
|
|
|
.height('100%')
|
|
|
.visibility(this.errorInfo == null ? Visibility.Visible : Visibility.None)
|
|
|
.mixedMode(MixedMode.All)//允许加载HTTP和HTTPS混合内容
|
|
|
- .zoomAccess(false)//不支持手势进行缩放
|
|
|
+ .zoomAccess(this.zoomAccess??false)//不支持手势进行缩放
|
|
|
.mediaPlayGestureAccess(false)//有声视频播放不需要用户手动点击
|
|
|
.cacheMode(CacheMode.Default)//设置缓存模式
|
|
|
.onConfirm((event) => { // 自定义Confirm弹窗
|
|
@@ -177,28 +178,28 @@ export struct XWebview {
|
|
|
console.log('mimetype:' + event.mimetype)
|
|
|
}
|
|
|
})
|
|
|
- .onErrorReceive((event) => { // 加载失败
|
|
|
- if (this.progress > 65) {
|
|
|
- return
|
|
|
- }
|
|
|
- if (event) {
|
|
|
- this.errorInfo = `错误码:${event.error.getErrorCode()}\n${event.error.getErrorInfo()}`
|
|
|
- } else {
|
|
|
- this.errorInfo = '错误码:-1\n未知错误'
|
|
|
- }
|
|
|
- ToolsHelper.log(this.errorInfo)
|
|
|
- })
|
|
|
- .onHttpErrorReceive((event) => { // 加载失败
|
|
|
- if (this.progress > 65) {
|
|
|
- return
|
|
|
- }
|
|
|
- if (event) {
|
|
|
- this.errorInfo = `错误码:${event.response.getResponseCode()}\n${event.response.getReasonMessage()}`
|
|
|
- } else {
|
|
|
- this.errorInfo = '错误码:-1\n未知错误'
|
|
|
- }
|
|
|
- ToolsHelper.log(this.errorInfo)
|
|
|
- })
|
|
|
+ // .onErrorReceive((event) => { // 加载失败
|
|
|
+ // if (this.progress > 65) {
|
|
|
+ // return
|
|
|
+ // }
|
|
|
+ // if (event) {
|
|
|
+ // this.errorInfo = `错误码:${event.error.getErrorCode()}\n${event.error.getErrorInfo()}`
|
|
|
+ // } else {
|
|
|
+ // this.errorInfo = '错误码:-1\n未知错误'
|
|
|
+ // }
|
|
|
+ // ToolsHelper.log(JSON.stringify(event),this.url)
|
|
|
+ // })
|
|
|
+ // .onHttpErrorReceive((event) => { // 加载失败
|
|
|
+ // if (this.progress > 65) {
|
|
|
+ // return
|
|
|
+ // }
|
|
|
+ // if (event) {
|
|
|
+ // this.errorInfo = `错误码:${event.response.getResponseCode()}\n${event.response.getReasonMessage()}`
|
|
|
+ // } else {
|
|
|
+ // this.errorInfo = '错误码:-1\n未知错误'
|
|
|
+ // }
|
|
|
+ // ToolsHelper.log( this.errorInfo,this.url)
|
|
|
+ // })
|
|
|
.onProgressChange((event) => { // 加载进度
|
|
|
if (event) {
|
|
|
console.log('newProgress:' + event.newProgress)
|