马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?立即注册
×
https://lbs.qq.com/dev/console/application/mine
去腾讯舆图申请key
然后前端页面引用
- <script type="text/javascript" src="https://apis.map.qq.com/tools/geolocation/min?key=YLMBZ-BJC6U-BD2VD-G6H26-2CWBQ-FIB3L&referer=test"></script>
复制代码 调用代码
- let geolocation = new (window).qq.maps.Geolocation('YLMBZ-BJC6U-BD2VD-G6H26-2CWBQ-FIB3L', 'test');
- console.log('geo----',geolocation)
- geolocation.getIpLocation(function(position) {
- console.log("Latitude is ---",position);
- console.log("Latitude is :", position.lat);
- console.log("Longitude is :", position.lng);
- }, function(error) {
- console.error("Error Code = " + error.code + " - " + error.message);
- })
复制代码 部分内容引用自
|