K***@163.com
K***@163.com
  • 发布:2021-11-17 16:40
  • 更新:2021-11-17 16:40
  • 阅读:494

web-view 跳转H5网页,APP页面空白,没有内容

分类:HBuilderX

config.js

let url_config = ""  
let gisDomain=""  
let url_h5 = ""  
let white_name = ""  
let white_id=""  
// gisDomain = "http://gisct.hdec.com"  
gisDomain = "http://zhps.hzyhwater.com:8001/gis"  
url_h5 = 'https://172.19.34.109:8443/h5/#/pages/login/login' //加载线上h5页面  
white_name = "form_8A5359DE05FF7D6D"  
white_id = "field116"  
console.log("环境",process.env)  
if(process.env.NODE_ENV === 'development'){  
// 开发环境  
url_config = 'http://localhost:8081/yh-mobile/'  
} else {  
url_config = 'http://yhswsim.hdec.com/api/'  
}  
console.log(url_config)  
export default {url_config,gisDomain,url_h5,white_name,white_id}

页面

<template>  
  <web-view :webview-styles="webviewStyles" :src="url" @message="handleMessage"></web-view>  
</template>  

<script>  
import url_h5 from "../../common/config"  
export default {  
  data() {  
    return {  
      webviewStyles: {  
        progress: {  
          color: "#00ff00"  
        }  
      },  
      ifStart: true,  
      deviceId:"",  
      currentPosition: {},  
      direction: null,  
      url:""  
    }  
  },  
  created() {  
  },  
  mounted() {  
    this.url=url_h5.url_h5  
    console.log("start get location");  
    let that = this;  
    uni.onCompassChange(function (res) {  
      that.direction = res.direction;  
    })  
    this.getLocation();  
    const GetDeviceId = uni.requireNativePlugin('uniplugin_device_id')  
    GetDeviceId.getAndroidId({}, (ret) => {  
      that.deviceId = ret  
        console.log("deviceId===>", that.deviceId)  
      that.whiteName()  
    })  
  },  
}  
</script>  

<style lang="scss" scoped>  
</style>

运行到手机,页面白屏,h5链接正常

2021-11-17 16:40 负责人:无 分享
已邀请:

该问题目前已经被锁定, 无法添加新回复