用plus.geolocation.getCurrentPosition的方式获取定位,在模拟器上真机运行可以,但是打包后就不行了,不显示,也没有报错。
代码:
<!doctype html>
<html>
<head>
<meta charset="UTF-8">
<title></title>
<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
<link href="css/mui.min.css" rel="stylesheet" />
<link rel="stylesheet" type="text/css" href="css/style.css" />
<script src="js/castapp.js" type="text/javascript" charset="utf-8"></script>
<script src="js/mui.min.js"></script>
<script type="text/javascript" src="js/common.js"></script>
<script type="text/javascript">
document.addEventListener('plusready', function(){
//console.log("所有plus api都应该在此事件发生后调用,否则会出现plus is undefined。"
//dingwei
var watchId;
function geoInf( position ) {
var str = "";
str += position.address.city+position.address.district+"\n";//获取地址信息
document.getElementById("dingwei").innerHTML = str;
}
// 通过定位模块获取位置信息
plus.geolocation.getCurrentPosition( geoInf, function ( e ) {
mui.toast("error:" + e.message);
});
});
</script>
</head>
1***@qq.com
请问咋配置呢?
2019-10-16 16:04