SHARE
TWEET

Untitled

a guest Sep 22nd, 2019 85 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // GisMap.vue
  2. <template>
  3.     <div id="2GisMap"></div>
  4. </template>
  5.  
  6. <script>
  7. import gMap from "2gis-maps";
  8.  
  9. export default {
  10.   name: "GisMap",
  11.   props: {
  12.     center: {
  13.       type: Array,
  14.       default: []
  15.     },
  16.     markers: {
  17.       type: Array,
  18.       default: []
  19.     },
  20.     zoom: {
  21.       type: Number,
  22.       default: 13
  23.     },
  24.   },
  25.   methods: {
  26.     init() {
  27.       let map;
  28.       gMap.then(() => {
  29.         map = DG.map("2GisMap", {
  30.           center: this.center,
  31.           zoom: this.zoom
  32.         });
  33.  
  34.           DG.marker(this.markers).addTo(map);
  35.       });
  36.     }
  37.   },
  38.   mounted() {
  39.     this.init();
  40.   }
  41. };
  42. </script>
  43.  
  44. // use
  45. <gis-map
  46.     :center="coords"
  47.     :markers="cords"
  48. ></gis-map>
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top