2***@qq.com
2***@qq.com
  • 发布:2019-07-26 14:11
  • 更新:2019-07-26 14:11
  • 阅读:607

云端打包,地图页面返回上页,手机黑屏;真机调试运行时正常。

分类:HTML5+

云端打包,地图页面返回上页,手机黑屏;真机调试运行时正常。代码如下:

<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 href="../css/mui.min.css" rel="stylesheet" />  
        <link rel="stylesheet" href="../css/app.css" />  
        <style>  
            .mui-btn {  
                padding: 10px;  
            }  

            .white .mui-content{  
                background: #fff;  
            }  

            #map {  
                width: 100%;  
                position: fixed;  
                top: 73px;  
                bottom: 0px;  
                line-height: 200px;  
                text-align: center;  
                background: #FFFFFF;  
            }  
        </style>  
        <script type="text/javascript">  
            var map = null;  
            // 扩展API加载完毕后调用onPlusReady回调函数   
            document.addEventListener('plusready', onPlusReady, false);  
            // 扩展API加载完毕,现在可以正常调用扩展API  
            function onPlusReady(){  
                getUserLocation();  
            }  

            // 获取用户的当前位置信息  
            function getUserLocation(){  
                map = new plus.maps.Map('map');    
                map.getUserLocation( function ( state, point ){    
                    if( 0 == state ){    
                        map.centerAndZoom(point, 18);  
                        addMarker(point);  
                        //alert(JSON.stringify(point));     
                    }else{    
                        alert( "Failed!" );  
                    }    
                } );  
            }  

            // 添加标点  
            var marker=null;  
            function addMarker(point){  
                if(marker){return;}  
                marker=new plus.maps.Marker(point);  
                marker.setIcon("position.png");  
                /* marker.setLabel("HBuilder");  
                var bubble = new plus.maps.Bubble("打造最好的HTML5移动开发工具");  
                marker.setBubble(bubble); */  
                map.addOverlay(marker);  
            }  

            // 删除标点  
            function removeMarker(){  
                map.removeOverlay(marker);  
                delete marker;  
                marker=null;  
            }  
        </script>  
    </head>  

    <body class="white">  
        <header id="header" class="mui-bar mui-bar-nav">  
            <a class="mui-action-back mui-icon mui-icon-left-nav mui-pull-left"></a>  
            <h1 class="mui-title">定位</h1>  
            <!--<button class="mui-btn mui-btn-blue mui-btn-link mui-pull-right" style="display: none;">通过</button>-->  
        </header>  

        <div id="vue-dom" class="mui-scroll-wrapper mui-content">  
            <div class="mui-scroll">  
                <div id="map">地图加载中...</div>  
            </div>  
        </div>  

        <script src="../js/mui.js"></script>  
        <script src="../js/app.js"></script>  
        <script type="text/javascript" src="../js/vue.js" ></script>  
        <script src="../js/pace.min.js"></script>  
    </body>  

</html>
2019-07-26 14:11 负责人:无 分享
已邀请:

该问题目前已经被锁定, 无法添加新回复