地图和定位可以在电脑上正常显示,但是在手机上无法获得准确定位

- 预期表现


- 复现路径


- 提供一个最简复现 Demo

<!--pages/parking/parking.wxml-->

<view class='container'>

  <map longitude="{{longitude}}" latitude="{{latitude}}" markers='{{markers}}' style='width:100%;height:{{view.Height}}px;'>

    <cover-view class='header'>

      <cover-view class='text'>暂时还没有登录,请登录后体验更多功能</cover-view>

      <cover-view class='btn btn-login' bindtap='login'>马上登录</cover-view>

    </cover-view>

    <cover-view class='footer'>

       <cover-view class='btn btn-more' bindtap='parkList'>查看全部</cover-view> 

    </cover-view>

  </map>

</view>




/**

  * 页面的初始数据

  */

data: {

latitude: '',

longitude: '',

Height: ''

},


/**

  * 生命周期函数--监听页面加载

  */

onLoad: function (options) {

var _this = this;

if (app.globalData.latitude && app.globalData.longitude) {

this.setData({

latitude: app.globalData.latitude, // 经度

longitude: app.globalData.longitude, // 纬度

markers: [{

id: 1,

latitude: app.globalData.latitude, // 经度

longitude: app.globalData.longitude, // 纬度

width: 20,

height: 30,

iconPath: '/img/location.png'

}]

})

}

wx.getSystemInfo({

success: function (res) {

_this.setData({

view: {

Height: res.windowHeight

}

})

}

})

},


展开全部
收起
1回答
提交回答
  • 至过去的我

    2044人对此回答表示赞同

    我是未来的你,你现在是不是在年找寻小程序答案。你不要感觉诧异,给你来信原因,就是让你不在后悔。今天去学习如何推广小程序,相信......点击查看更多>
    发布于
  • 文心雕龙

    15人对此回答表示赞同

    麻烦给个相关的代码片段,我们定位下问题

    展开
    15
    0回复
    发布于 6年前

    评论(0)

    收起评论

A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
咨询热线

13312967497

扫码添加业务即可随时咨询 还可领取小程序推广攻略

业务咨询: 13312967497
扫码咨询

扫码咨询套餐

回到顶部