address selection: fix leaflet icon url + others fix (WIP)

This commit is contained in:
nobohan
2021-05-11 14:56:56 +02:00
parent ea0b2407df
commit c3926991ac
5 changed files with 22 additions and 60 deletions

View File

@@ -31,7 +31,7 @@
</div>
<div class="address_form__map">
<address-map>
<address-map ref="addressMap">
</address-map>
</div>
@@ -88,7 +88,7 @@ export default {
this.$store.commit('setIsNoAddress', v);
},
get() {
return this.$store.state.form.isNoAddress; //this.add_address.form.isNoAddress
return this.$store.state.form.isNoAddress; //TODO could be this.add_address.form.isNoAddress
}
},
},

View File

@@ -1,12 +1,13 @@
<template>
<div class="container">
<div id='address_map' v-bind='init' style='height:400px; width:400px;'></div>
<div id='address_map' style='height:400px; width:400px;'></div>
</div>
</template>
<script>
import L from 'leaflet';
import markerIconPng from 'leaflet/dist/images/marker-icon.png'
import 'leaflet/dist/leaflet.css';
let map;
@@ -25,11 +26,6 @@ export default {
}
},
},
// watch: {
// center: get() {
// console.log()
// }
// },
methods:{
init() {
map = L.map('address_map').setView([48.8589, 2.3469], 12);
@@ -38,16 +34,16 @@ export default {
attribution: '&copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors'
}).addTo(map);
L.marker([48.8589, 2.3469]).addTo(map)
.bindPopup('A pretty CSS3 popup.<br> Easily customizable.')
.openPopup();
const markerIcon = L.icon({
iconUrl: markerIconPng,
});
L.marker([48.8589, 2.3469], {icon: markerIcon}).addTo(map);
console.log(map);
},
update() {
console.log('update map', this.$store.state.addressMap.center)
map.setView(this.$store.state.addressMap.center, 12);
//TODO update map view based on the store map centerS
console.log('update map with : ', this.$store.getMapCenter())
map.setView(this.$store.getMapCenter(), 12);
}
},
mounted(){