您当前的位置: 首页 >  ios

喜欢猪猪

暂无认证

  • 1浏览

    0关注

    228博文

    0收益

  • 0浏览

    0点赞

    0打赏

    0留言

私信
关注
热门博文

关于IOS10系统内微信公众号地图的显示问题

喜欢猪猪 发布时间:2017-02-28 09:29:37 ,浏览量:1

1.使用腾讯位置服务可以完美的解决问题,已使用测试;

2.具体的解决方案:

调用方式1:引用封装好的JS模块,调起前端的定位组件,通过封装好的接口获取位置信息。

js引入地址:https://3gimg.qq.com/lightmap/components/geolocation/geolocation.min.js 

    
     前端定位模块
    
    
         * {
             margin: 0;
             padding: 0;
             border: 0;
         }
         body {
             position: absolute;
             width: 100%;
             height: 100%;
             text-align: center;
         }
         #pos-area {
             background-color: #009DDC;
             margin-bottom: 10px;
             width: 100%;
             overflow: scroll;
             text-align: left;
             color: white;
         }
         #demo {
             padding: 8px;
             font-size: small;
         }
         #btn-area {
             height: 100px;
         }
         button {
             margin-bottom: 10px;
             padding: 12px 8px;
             width: 42%;
             border-radius: 8px;
             background-color: #009DDC;
             color: white;
         }
    
    
    
        

点击下面的按钮,获得对应信息:

    
 
    
         获取精确定位信息
         获取粗糙定位信息
         开始监听位置
         停止监听位置
    
    
         var geolocation = new qq.maps.Geolocation( "OB4BZ-D4W3U-B7VVO-4PJWW-6TKDJ-WPB77" , "myapp" );
 
         document.getElementById( "pos-area" ).style.height = (document.body.clientHeight - 110) + 'px' ;
 
         var positionNum = 0;
         var options = {timeout: 8000};
         function showPosition(position) {
             positionNum ++;
             document.getElementById( "demo" ).innerHTML += "序号:" + positionNum;
             document.getElementById( "demo" ).appendChild(document.createElement( 'pre' )).innerHTML = JSON.stringify(position, null , 4);
             document.getElementById( "pos-area" ).scrollTop = document.getElementById( "pos-area" ).scrollHeight;
         };
 
         function showErr() {
             positionNum ++;
             document.getElementById( "demo" ).innerHTML += "序号:" + positionNum;
             document.getElementById( "demo" ).appendChild(document.createElement( 'p' )).innerHTML = "定位失败!" ;
             document.getElementById( "pos-area" ).scrollTop = document.getElementById( "pos-area" ).scrollHeight;
         };
 
         function showWatchPosition() {
             document.getElementById( "demo" ).innerHTML += "开始监听位置!" ;
             geolocation.watchPosition(showPosition);
             document.getElementById( "pos-area" ).scrollTop = document.getElementById( "pos-area" ).scrollHeight;
         };
 
         function showClearWatch() {
             geolocation.clearWatch();
             document.getElementById( "demo" ).innerHTML += "停止监听位置!" ;
             document.getElementById( "pos-area" ).scrollTop = document.getElementById( "pos-area" ).scrollHeight;
         };
    
3.原创作品,请勿转载

关注
打赏
1648795721
查看更多评论
立即登录/注册

微信扫码登录

0.0817s