- 为什么markers在地图上图片不显示?有警告说markers应该是一个数字
<view class="map"> <map id="map" longitude="{{ longitude }}" latitude="{{ latitude }}" scale="14" show-location markers="{{markers}}"></map> </view> 页面 getNearUsers(){ db.collection('users').where({ location: _.geoNear({ geometry: db.Geo.Point(this.data.longitude, this.data.latitude), minDistance: 0, maxDistance: 5000 }), isLocation : true }).field({ longitude : true, latitude : true, userPhoto : true }).get().then((res)=>{ // console.log( res.data ); let data = res.data; let result = []; if( data.length ){ for( let i =0; i< data.length; i++ ){ result.push({ iconpath: data[i].userPhoto , id : data[i]._id, latitude:data[i].latitude, longitude:data[i].longitude, width : 30, height : 30 }); } this.setData({ markers : result }); } }); } js [/__pageframe__/pages/near/near] marker id should be a number 这是警告
2021-01-26 - 在页面上为什么获取不到ID?
<movable-area class="area" > <movable-view direction="horizontal" class="view" >{{userMessage.nickName}}</movable-view> <navigator url="{{'/pages/detail/detail? userId=' + userMessage._id}}" open-type="navigate"> <image src="{{userMessage.userPhoto}}" /> </navigator> <view class="delete" >删除</view> </movable-area> 为什么这样获取不到id呢? lifetimes: { attached: function() { db.collection('users').doc(this.data.messageId).field({ userPhoto:true, nickName:true }).get().then((res)=>{ this.setData({ userMessage: res.data }) }) } } 这是报错 VM2036 WAService.js:2 Error: errCode: -1 | errMsg: collection.doc:fail docId must not be empty; at collection.doc api;
2021-01-26 - 用field为啥运行显示where?
db.collection('users').field({ userPhoto:true, nickName:true, links:true }) .get().then((res)=>{ this.setData({ listData : res.data }); }); 为什么运行的出来的跟写的代码不一样·呢 db.collection('users').where({}) .field({ userPhoto: true, nickName: true, links: true }) .get() 发起的如下数据库查询经自动检测发现以下问题
2021-01-22