You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

100 lines
2.2 KiB

<template>
<view :style="{'padding-top': statusHeight + 'px'}" class="content">
<!-- <s-layout title="首页" navbar="custom" tabbar="/pages/index/index" :bgStyle="template.page"
:navbarStyle="template.style?.navbar" onShareAppMessage>
</s-layout> -->
<map :latitude="latitude" :longitude="longitude" class="maps"
:style="{'width': windowWidth + 'px', 'height': windowHeight + 'px'}" :enable-rotate="true" id="maps"
:markers="covers" :show-location="true">
<uni-nav-bar left-icon="left" title="行程轨迹" right-icon="paperplane" backgroundColor="#e6eafa"
@clickLeft="handlegoback" />
<!-- -->
<button @click="handle_maps">点击</button>
</map>
<!-- <s-tabbar path="/pages/home/components/mapnvue" /> -->
</view>
</template>
<script>
import {
baseUrl,
apiPath
} from '@/sheep/config';
export default {
data() {
return {
info: {},
statusHeight: 0,
windowWidth: 0,
windowHeight: 0,
latitude: 31.49099,
longitude: 120.31237,
covers: [{
id: 15131351,
label: '当前位置',
latitude: 31.49881,
longitude: 120.318583,
}],
pop_botmms: true,
polyline: [{
points: [],
color: '#000',
width: 8
}],
_mapContext: null,
}
},
methods: {
handlegoback() {
uni.navigateBack()
},
handle_maps(){
this._mapContext.includePoints({
points: [{
latitude: 31.52853,
longitude: 120.28429
},
{
latitude: 31.52854,
longitude: 120.2848
},
{
latitude: 31.52855,
longitude: 120.28427
}
],
success: (response) => {
console.log(response, '成功')
},
fail: (error) => {
console.log(error, 'error')
},
complete: (complete) => {
console.log(complete, 'complete')
}
});
}
},
created() {},
mounted() {
let info_mation = uni.getSystemInfoSync()
this.statusHeight = info_mation.statusBarHeight
this.windowWidth = info_mation.windowWidth
this.windowHeight = info_mation.windowHeight
// this.handle_map()
},
onReady() {
this._mapContext = uni.createMapContext("maps", this);
},
onLoad(option) {
// console.log(option, 'option');
}
}
</script>
<style>
</style>