use Leaflet Fullscreen in Vue2Leaflet - Javascript Leaflet

Javascript examples for Leaflet:Configuration

Description

use Leaflet Fullscreen in Vue2Leaflet

Demo Code

ResultView the demo in separate window

<html>
   <head> 
      <title>Vue2Leaflet Demo</title> 
      <meta name="viewport" content="width=device-width, initial-scale=1"> 
      <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/vue/2.5.16/vue.js"></script> 
      <link rel="stylesheet" type="text/css" href="https://unpkg.com/leaflet@1.0.3/dist/leaflet.css"> 
      <script type="text/javascript" src="https://unpkg.com/leaflet@1.0.3/dist/leaflet.js"></script> 
      <script type="text/javascript" src="https://unpkg.com/vue2-leaflet@1.0.1/dist/vue2-leaflet.js"></script> 
      <link rel="stylesheet" type="text/css" href="https://api.mapbox.com/mapbox.js/plugins/leaflet-fullscreen/v1.0.1/leaflet.fullscreen.css"> 
      <script type="text/javascript" src="https://api.mapbox.com/mapbox.js/plugins/leaflet-fullscreen/v1.0.1/Leaflet.fullscreen.min.js"></script> 
      <style id="compiled-css" type="text/css">

html, body, #app {
   height: 100%;
   margin: 0;
}


      </style> 
      <script type="text/javascript">
    window.onload=function(){//from  www.  ja  v a  2 s. c  o m
var { LMap, LTileLayer, LMarker } = Vue2Leaflet;
new Vue({
  el: '#app',
  components: { LMap, LTileLayer, LMarker },
  data() {
    return {
      zoom:13,
      center: L.latLng(47.413220, -1.219482),
      url:'http://{s}.tile.osm.org/{z}/{x}/{y}.png',
      attribution:'&copy; <a href="http://osm.org/copyright">OpenStreetMap</a> contributors',
      marker: L.latLng(47.413220, -1.219482),
    };
  },
  mounted() {
     const map = this.$refs.mymap.mapObject;
    map.addControl(new L.Control.Fullscreen());
  }
});
    }

      </script> 
   </head> 
   <body>  
      <div id="app"> 
         <l-map :zoom="zoom" :center="center" ref="mymap"> 
            <l-tile-layer :url="url" :attribution="attribution"></l-tile-layer> 
            <l-marker :lat-lng="marker"></l-marker> 
         </l-map> 
      </div>   
   </body>
</html>

Related Tutorials