<view class="map-section">
<view style="width:100%;height:100%;">
<web-view class="vue-ref" style="width:100%;height:100%;" bindmessage="handleGetMessage"
src="http://192.168.43.9:10011/system/ehcacheequipment/map" data-ref="webview"></web-view>
</view>
</view>
<script type="text/javascript" src="https://res.wx.qq.com/open/js/jweixin-1.6.0.js"></script><!--1.3。2也试过-->
<script type="text/javascript">
var map;
$(function () {
selectmap();
//正常
wx.miniProgram.getEnv(function(res) {
console.log(res.miniprogram) // true
if (!res.miniProgram) {
alert("不是小程序");
} else {
alert("111");
}
})
})
function fh() {
//都一个一个试过无效 alert有弹出
wx.miniProgram.switchTab({url: '/pages/superAdminPersonal/equipment/equipment'});
wx.miniProgram.navigateBack({delta: 1});
// wx.miniProgram.postMessage({ data: 'foo' })
// setInterval(function(){alert(2); wx.miniProgram.switchTab({
// url: '/pages/superAdminPersonal/equipment/equipment'
// }) }, 3000);
// // wx.miniProgram.redirectTo({
// // url: '/pages/superAdminPersonal/equipment/equipment'
// // })
}
测试环境(真机调试2.0)
可以直接下载weixin.js到文件中引进试试
fh为按钮调用