manifest.json 文件
{
"name" : "HappyTV",
"appid" : "__UNI__90E7BB0",
"description" : "基于uni-app开发的新闻/资讯类App模板",
"versionName" : "1.0.0",
"versionCode" : "100",
"transformPx" : false,
"app-plus" : {
"usingComponents" : true,
/* 5+App特有相关 */
"modules" : {
"OAuth" : {},
"Payment" : {},
"Share" : {},
"VideoPlayer" : {}
},
"nativePlugins" : {},
"splashscreen" : {
"waiting" : true
},
"useragent": {
"value": "Mozilla/5.0 (Linux;U;Android 7.1.2;zh-cn;Galaxy Nexus Build/JRO03C) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/71.0.3578.141 Mobile Safari/537.36",
"concatenate": false
}
},
/* SDK配置 */
"quickapp" : {},
/* 快应用特有相关 */
"mp-weixin" : {
/* 小程序特有相关 */
"appid" : "",
"setting" : {
"urlCheck" : false
},
"usingComponents" : true
},
"h5" : {
"router" : {
"base" : "/h5"
},
"template" : "h5.template.html",
"title" : "HappyTv",
"async" : {
"loading" : "AsyncLoading", //页面js加载时使用的组件(需注册为全局组件)
"error" : "AsyncError", //页面js加载失败时使用的组件(需注册为全局组件)
"delay" : 200, //展示 loading 加载组件的延时时间(页面 js 若在 delay 时间内加载完成,则不会显示 loading 组件)
"timeout" : 999999
}
}
}
index.vue页面
<template>
<web-view :src="viewUrl" @message="handleMessage"></web-view>
</template>
<script>
var wv;//计划创建的webview
export default {
name: 'redirect',
components: {
},
data() {
return {
viewUrl: '',
method: '',
}
},
onLoad(query) {
const system = uni.getSystemInfoSync();
console.log('onLoad', JSON.stringify(query), JSON.stringify(system));
var native="";
// #ifdef APP-PLUS
native="2"
// #endif
this.viewUrl = `https://test.happytvtech.com/html/google.html?native=2&method=login`
// #ifdef APP-PLUS
var currentWebview = this.$mp.page.$getAppWebview() //获取当前页面的webview对象
setTimeout(function() {
wv = currentWebview.children()[0]
if (wv) wv.setStyle({top:system.statusBarHeight+44})
}, 1000); //如果是页面初始化调用时,需要延时一下
// #endif
},
mounted() {
},
onShow() {
console.log('onShow');
},
// onLoad() {
// console.log('onReady redirect')
//
// },
methods: {
handleMessage(evt) {
console.log('接收到的消息:');
}
}
}
</script>
<style>
</style>
https://test.happytvtech.com/html/google.html 这个链接在webview 中打开后,会打印出当前 页面的userAgent 数据,一眼就能看到
麻烦你了
4***@qq.com
我也遇到这个问题了
2019-09-11 21:53