Commit 6f465ab2 authored by 黄奎's avatar 黄奎

页面修改

parent d67be0df
......@@ -18,7 +18,7 @@
</template>
<script>
export default {
props: ["dataList"],
props: ["locationArray"],
name: 'tripMap',
data() {
return {
......@@ -29,7 +29,7 @@
}
},
watch: {
dataList(newValue, old) {
locationArray(newValue, old) {
this.mapBuild()
}
},
......@@ -69,9 +69,10 @@
},
// 地图实例
mapBuild() {
if (this.dataList && this.dataList.length > 0) {
let lat = parseFloat(this.dataList[0].lat)
let lng = parseFloat(this.dataList[0].lng)
if (this.locationArray && this.locationArray.length > 0) {
let lat = parseFloat(this.locationArray[0].lat)
let lng = parseFloat(this.locationArray[0].lng)
let center = {
lng: lng,
lat: lat
......@@ -90,7 +91,7 @@
// let poly = new google.maps.Polyline(polyOptions);
// poly.setMap(map); // 装载
// 遍历循环创建标记
// this.dataList.map(item=>{
// this.locationArray.map(item=>{
// // let lat = parseFloat(item.lat)
// // let lng = parseFloat(item.lng)
// // var path = poly.getPath(); //获取线条的坐标
......@@ -120,18 +121,18 @@
},
calcRoute: function () { // 创建路径规划
// 分解数据 获得起 止 以及中间数据
console.log(this.dataList, '加载后....');
let lat = parseFloat(this.dataList[0].lat)
let lng = parseFloat(this.dataList[0].lng)
let elat = parseFloat(this.dataList[this.dataList.length - 1].lat)
let elng = parseFloat(this.dataList[this.dataList.length - 1].lng)
console.log(this.locationArray, '加载后....');
let lat = parseFloat(this.locationArray[0].lat)
let lng = parseFloat(this.locationArray[0].lng)
let elat = parseFloat(this.locationArray[this.locationArray.length - 1].lat)
let elng = parseFloat(this.locationArray[this.locationArray.length - 1].lng)
let _this = this;
let start = lat + ',' + lng;
let end = elat + ',' + elng;
let waypoints = [];
if (this.dataList.length > 2) {
this.dataList.forEach((x, index) => {
if (index >= 1 && index !== (this.dataList.length - 1)) {
if (this.locationArray.length > 2) {
this.locationArray.forEach((x, index) => {
if (index >= 1 && index !== (this.locationArray.length - 1)) {
let obj = {
location: x.lat + ',' + x.lng
}
......
......@@ -1101,7 +1101,7 @@
</div>
</div>
<div class="viewTripMap">
<tripMap :dataList="travelLngLat" :type="1" ref="tripMap"></tripMap>
<tripMap :locationArray="travelLngLat" :type="1" ref="tripMap"></tripMap>
</div>
</div>
</div>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment