最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Leaflet.Draw rising TypeError: L.Control.Draw is not a constructor - Stack Overflow

programmeradmin2浏览0评论

I'm trying to initialize a simple Leaflet instance with Leaflet.Draw plugin enabled. I followed all the tutorials i was able to find anywhere on the internet but the error persists: TypeError: L.Control.Draw is not a constructor on L.map line.

My code looks as follows:

import L from 'leaflet19';
import 'leaflet-draw';

const map = L.map('map', {
  drawControl: true,
}).setView([51.505, -0.09], 13);

L.tileLayer("/{z}/{x}/{y}.png", {
  maxZoom: 19,
  attribution:
    '&copy; <a href=";>OpenStreetMap</a>',
}).addTo(map);

I'm on leaflet 1.9.4 ("leaflet19": "npm:[email protected]") and leaflet-draw 1.0.4

发布评论

评论列表(0)

  1. 暂无评论