版权声明:非经本人同意,请勿转载。 https://blog.csdn.net/QQ_Empire/article/details/82802086
https://blog.csdn.net/qq_16479139/article/details/80018670
https://blog.csdn.net/qq_22945185/article/details/81257403
https://blog.csdn.net/qq_39588818/article/details/79421025
在vue项目中引入高德地图及其UI组件https://blog.csdn.net/shuaizi96/article/details/73611254/
在vue+webpack项目中引入高德地图API
https://blog.csdn.net/dadaDaShiXiong/article/details/79796232
react-native中引入高德地图
https://blog.csdn.net/IT_luntan/article/details/78982497
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
<title></title>
<link rel="stylesheet" type="text/css" href="css/mui.min.css"/>
<script src="js/jquery-1.11.0.js" type="text/javascript" charset="utf-8"></script>
<script type="text/javascript" src="https://webapi.amap.com/maps?v=1.4.10&key=e4e80d2aa0d24783d16e916c8d5058d1"></script>
<style type="text/css">
#out{
width: 90vw;
height: 70vh;
border: 1px solid red;
margin-left:5vw ;
margin-top: 20px;
position: relative;
overflow: hidden;
}
</style>
</head>
<body>
<header class="mui-bar mui-bar-nav">
<h1 class="mui-title">设备</h1>
</header>
<div class="mui-content">
<div id="out">
</div>
<button type="button" class="mui-btn mui-btn-blue">设备--获取位置</button>
</div>
</body>
<script type="text/javascript">
document.addEventListener('plusready',Plusready,false)
function Plusready(){
$('button').eq(0).click(function(){
// alert(plus.device.model)
// 打电话
// plus.device.dial( '110', false );
// 蜂鸣
// plus.device.beep( 300 );
// 震动
// plus.device.vibrate( 2000 );
// 设置音量
// plus.device.setVolume( 0 );
// 定位
plus.geolocation.getCurrentPosition(successCB, errorCB);
})
}
function successCB(a){
// alert(a.address.district+a.address.street)
var marker = new AMap.Marker({
position: new AMap.LngLat(a.coords.longitude, a.coords.latitude), // 经纬度对象,也可以是经纬度构成的一维数组[116.39, 39.9]
title: a.address.district
});
var map = new AMap.Map('out', {
zoom:18,//级别
center: [a.coords.longitude, a.coords.latitude],//中心点坐标
viewMode:'3D'//使用3D视图
});
map.add(marker);
}
function errorCB(){
alert('err')
}
</script>
</html>