JS中动态改了polyline.points,因为polyline是数组,所以我设置了第一个个元素[0],从log中可以看到后台数据确实是改变了,但是地图上的polyline始终没有变化,应该是个bug

WXML文件内容:

<map id="map" longitude="{{x}}" latitude="{{y}}" scale="14" controls="{{controls}}" bindcontroltap="controltap" markers="{{markers}}" bindmarkertap="markertap" polyline="{{polyline}}" bindregionchange="regionchange" bindcontroltap="moveToLocation" show-location

style="width: 100%; height: 60vh;"></map>

<button bindtap="test" class="weui-btn mini-btn" type="primary" size="mini">选取坐标</button>

JS文件内容:

test: function () {

var testpoints = [{

longitude: 121.43686999999998,

latitude: 31.18826000000001

}, {

longitude: 113.324520,

latitude: 23.21229

}]

this.data.polyline[0].points = testpoints

},

JS文件中的data内容:

data: {

polyline: [{

points: [{

longitude: 113.3245211,

latitude: 23.10229

}, {

longitude: 113.324520,

latitude: 23.21229

}],

color: "#FF0000DD",

width: 2,

dottedLine: true

}]

}


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

    2044人对此回答表示赞同

    我是未来的你,你现在是不是在年找寻小程序答案。你不要感觉诧异,给你来信原因,就是让你不在后悔。今天去学习如何推广小程序,相信......点击查看更多>
    发布于
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
扫码咨询

扫码咨询套餐

回到顶部