收藏
回答

对于地图控件,marker最大只支持20个吗

框架类型 问题类型 API/组件名称 终端类型 微信版本 基础库版本
小程序 Bug 小程序 工具 7.0.10 2.0.0


RT

// pages/map/map.js const app = getApp() const db = wx.cloud.database({}); const cont = db.collection('train_stations'); Page({ data: { train_station:[], // markers:[], latitude: 35, longitude: 105,//中心经纬度 markers: [{ id: 1, latitude: 23.099994, longitude: 113.324520, name: 'T.I.T 创意园' },{ latitude: 23.099994, longitude: 113.344520, }, { latitude: 23.099994, longitude: 113.304520, }, { latitude: 43.099994, longitude: 123.304520, } ] }, onReady: function (e) { this.mapCtx = wx.createMapContext('myMap') }, // 获取位置 getCenterLocation: function () { this.mapCtx.getCenterLocation({ success: function (res) { console.log(res.longitude) console.log(res.latitude) } }) }, // 移动位置 moveToLocation: function () { this.mapCtx.moveToLocation() }, // 移动标注 translateMarker: function () { this.mapCtx.translateMarker({ markerId: 1, autoRotate: true, duration: 1000, destination: { latitude: 23.10229, longitude: 113.3345211, }, animationEnd() { console.log('animation end') } }) }, // 缩放视野展示所有经纬度 includePoints: function () { this.mapCtx.includePoints({ padding: [100], points: [{ latitude: 25.10229, longitude: 125.3345211, }, { latitude: 50.00229, longitude: 85.3345211, }] }) }, /** * 生命周期函数--监听页面加载 */ onLoad: function (options) { //新增 //新增 var that = this; wx.getSystemInfo({ success: function (res) { // that.setData({ // windowWidth: res.windowWidth // }) } }); console.log(options) db.collection('train_stations').limit(300).get({ success: res => { console.log(res.data[0]); this.setData({ train_station: res.data, markers:res.data, }) wx.showToast({ title: 'success', }) console.log("云数据库调用成功") } }) //新增 }, /** * 生命周期函数--监听页面初次渲染完成 */ // onReady: function () { // }, /** * 生命周期函数--监听页面显示 */ // onShow: function () { // }, /** * 生命周期函数--监听页面隐藏 */ // onHide: function () { // }, /** * 生命周期函数--监听页面卸载 */ // onUnload: function () { // }, /** * 页面相关事件处理函数--监听用户下拉动作 */ // onPullDownRefresh: function () { // }, /** * 页面上拉触底事件的处理函数 */ // onReachBottom: function () { // }, /** * 用户点击右上角分享 */ onShareAppMessage: function () { } })
回答关注问题邀请回答
收藏

2 个回答

  • 拾忆
    拾忆
    2020-02-08

    不止20个。

    2020-02-08
    有用
    回复 2
    • Wade
      Wade
      2020-02-08
      谢谢解答,因为数据库每次连接最大是20个
      2020-02-08
      回复
    • 拾忆
      拾忆
      2020-02-08回复Wade

      那是云开发的默认限制,普通数据库没有这个限制。

      2020-02-08
      回复
  • Wade
    Wade
    2020-02-08

    谢谢你的解答 我的微信是littlefly666

    2020-02-08
    有用
    回复
登录 后发表内容
问题标签