12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455 |
- <template>
- <view>
- <view class="page-body">
- <view class="page-section page-section-gap">
- <map style="width: 100%;height: 100vh;" :markers="markers" :longitude="longitude" :latitude="latitude" :circles="circles">
- </map>
- </view>
- </view>
- </view>
- </template>
- <script>
- export default {
- data() {
- return {
- circles: [], //圆
- markers: [], //标记点
- latitude: 39.9,
- longitude: 116.4,
- };
- },
- onLoad() {
- const _this = this;
- uni.getSystemInfo({
- success: (res) => {
- _this.mapHeight = res.screenHeight - res.statusBarHeight
- _this.mapHeight = _this.mapHeight
- }
- })
- },
- created() {
- var that = this
- uni.getLocation({
- type: 'wgs84',
- success(res) {
- console.log(res, "当前位置");
- that.latitude = res.latitude
- that.longitude = res.longitude
- //标记点
- that.markers = [{
- id: 1,
- latitude: res.latitude,
- longitude: res.longitude,
- iconPath: '/static/sailun/map-pin.png',
- }]
- }
- });
- }
- }
- </script>
- <style lang="scss">
- </style>
|