123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778 |
- <template>
- <view class="">
- <map style="width: 100%; height: 100vh;" :latitude="latitude" :longitude="longitude" :markers="covers"
- @tap="clickMap">
- <cover-view class="address_box">点击地图选择位置</cover-view>
-
- </map>
- <cover-view class="sure" @click="surePosi">确定</cover-view>
- </view>
- </template>
- <script>
- export default {
- data() {
- return {
- latitude: 39.909,
- longitude: 116.39742,
- covers: [{
- latitude: 39.909,
- longitude: 116.39742,
- }]
- }
- },
- onLoad(options) {
- console.log(options)
- this.latitude = options.lat
- this.longitude = options.lng
- this.covers = [{
- latitude: options.lat,
- longitude: options.lng,
- }]
- },
- methods: {
- clickMap(e) {
- console.log(e, 'ppp')
- this.covers = [{
- latitude: e.detail.latitude,
- longitude: e.detail.longitude,
- }]
- this.latitude = e.detail.latitude
- this.longitude = e.detail.longitude
- },
- surePosi() {
- console.log('ppppppppppppppppp')
- uni.reLaunch({
- url:'./index?lat=' + this.latitude + '&lng=' + this.longitude
- })
-
- }
- }
- }
- </script>
- <style lang="scss" scoped>
- .address_box {
- height: 35px;
- line-height: 35px;
- padding-left: 15px;
- color: #fff;
- background-color: #ff6a14;
- }
- .sure {
- height: 35px;
- width: 30%;
- text-align: center;
- line-height: 35px;
- bottom: 40px;
- border-radius: 8px;
- left: 35%;
- position: fixed;
- color: #fff;
- z-index: 9999;
- background-color: #ff6a14;
- }
- </style>
|