uni-app ios18 webview nvue加载网页白屏

发布于 1周前 作者 zlyuanteng 来自 Uni-App

uni-app ios18 webview nvue加载网页白屏

开发环境 版本号 项目创建方式
Mac 15.0.1 HBuilderX

产品分类:uniapp/App

PC开发环境操作系统:Mac

HBuilderX类型:正式

HBuilderX版本号:4.29

手机系统:iOS

手机系统版本号:iOS 18

手机厂商:苹果

手机机型:iphone11

页面类型:vue

vue版本:vue2

打包方式:云端

项目创建方式:HBuilderX


示例代码:

<template>  
    <web-view ref="webview" :src="weburl" :style="{height:mbHeight,width:mbWidth,top:0}" :webview-styles="webviewStyles" fullscreen="true" @load="load" @onPostMessage="handlePostMessage"></web-view>
</template>  

<script>
export default {
    data() {
        return {
            weburl: '',
            mbBottom: uni.getSystemInfoSync().windowBottom + 'px',
            mbWidth: uni.getSystemInfoSync().screenWidth + 'px',
            mbHeight: uni.getSystemInfoSync().screenHeight + 'px',
            webviewStyles: {
                progress: false
            }
        }
    },
    onLoad(item) {
        console.log(item, uni.getSystemInfoSync().screenWidth, uni.getSystemInfoSync().screenHeight, uni.getSystemInfoSync().windowBottom)
        // this.weburl = item.url
        this.weburl = 'http://www.baidu.com'
    }
}
</script>  

操作步骤:

<template>  
    <web-view ref="webview" :src="weburl" :style="{height:mbHeight,width:mbWidth,top:0}" :webview-styles="webviewStyles" fullscreen="true" @load="load" @onPostMessage="handlePostMessage"></web-view>
</template>  

<script>
export default {
    data() {
        return {
            weburl: '',
            mbBottom: uni.getSystemInfoSync().windowBottom + 'px',
            mbWidth: uni.getSystemInfoSync().screenWidth + 'px',
            mbHeight: uni.getSystemInfoSync().screenHeight + 'px',
            webviewStyles: {
                progress: false
            }
        }
    },
    onLoad(item) {
        console.log(item, uni.getSystemInfoSync().screenWidth, uni.getSystemInfoSync().screenHeight, uni.getSystemInfoSync().windowBottom)
        // this.weburl = item.url
        this.weburl = 'http://www.baidu.com'
    }
}
</script>  

回到顶部