|
@ -7,18 +7,18 @@ |
|
|
:polyline="polyline" |
|
|
:polyline="polyline" |
|
|
id="map" |
|
|
id="map" |
|
|
ref="map" |
|
|
ref="map" |
|
|
|
|
|
scale="12" |
|
|
show-location="true" |
|
|
show-location="true" |
|
|
:include-points="markers" |
|
|
style="width: 100%; min-height: 1000rpx;height:100%" |
|
|
style="width: 100%; height: 1000rpx;" |
|
|
|
|
|
/> |
|
|
/> |
|
|
</template> |
|
|
</template> |
|
|
|
|
|
|
|
|
<script> |
|
|
<script> |
|
|
export default { |
|
|
export default { |
|
|
props: { |
|
|
props: { |
|
|
markers: { type: Array, default: null }, |
|
|
markers: { type: Array, default: () => [] }, |
|
|
polyline: { type: Array, default: null }, |
|
|
polyline: { type: Array, default: () => [] }, |
|
|
polygons: { type: Array, default: null }, |
|
|
polygons: { type: Array, default: () => [] }, |
|
|
}, |
|
|
}, |
|
|
data() { |
|
|
data() { |
|
|
return { |
|
|
return { |
|
@ -26,24 +26,19 @@ export default { |
|
|
longitude: 112.55067, |
|
|
longitude: 112.55067, |
|
|
}; |
|
|
}; |
|
|
}, |
|
|
}, |
|
|
|
|
|
watch: { |
|
|
onLoad() { |
|
|
markers: { |
|
|
this.getLocation(); |
|
|
deep: true, |
|
|
}, |
|
|
handler(value) { |
|
|
|
|
|
if (value && value.length) { |
|
|
methods: { |
|
|
const { latitude, longitude } = value[0]; |
|
|
// 获取当前的地址位置 |
|
|
this.latitude = latitude; |
|
|
// 注意用国测局的数据 map只支持gcj02 |
|
|
this.longitude = longitude; |
|
|
getLocation() { |
|
|
} else { |
|
|
uni.getLocation({ |
|
|
this.latitude = 37.87059; |
|
|
type: 'gcj02', |
|
|
this.longitude = 112.55067; |
|
|
success: res => { |
|
|
} |
|
|
this.longitude = res.longitude; |
|
|
|
|
|
this.latitude = res.latitude; |
|
|
|
|
|
console.log('当前位置的经度:' + res.longitude); |
|
|
|
|
|
console.log('当前位置的纬度:' + res.latitude); |
|
|
|
|
|
}, |
|
|
}, |
|
|
}); |
|
|
|
|
|
}, |
|
|
}, |
|
|
}, |
|
|
}, |
|
|
}; |
|
|
}; |
|
|