|

楼主 |
发表于 2016-10-12 12:11:39
|
显示全部楼层
引用的是一个普通的HTML页面,我在本机没有安装模拟器,在浏览器中运行报错。下面是我的代码:- var flag=1;
- var Model = function(){
- this.callParent();
- };
- Model.prototype.modelLoad = function(event){
- var me=this;
-
- function successCallback(position){
- //alert("地址"+position.address);
- //alert("坐标系"+position.coorType);
- //alert("经度坐标"+position.coords.longitude);
- //alert("纬度坐标"+position.coords.latitude);
- //alert(JSON.stringify(position));
- //setInterval(function timer(){
- if(flag==1){
- me.comp('windowDialog').open({data:JSON.stringify(position)});
- }
- flag=0;
- //},10000);
-
- }
- function errorCallback(error){
- alert("发生错误");
- }
- navigator.geolocation.getCurrentPosition(successCallback, errorCallback);
-
- };
- Model.prototype.mapDataReceiverReceive = function(event){
- var position = event.data;
- var mapPanelId = $(this.getElementByXid("mapPanel")).attr('id');
- var $mapFrame = $('#' + mapPanelId + ' iframe');
- var mapFrame = $mapFrame.get(0);
- $mapFrame.on('load',function(){
- mapFrame.contentWindow.postMessage(position, "*");
- });
- //alert(event.data);
- };
复制代码
|
|