Angular未识别LeafletTimeDimension
创始人
2024-10-29 23:01:01
0

在Angular项目中引入Leaflet TimeDimension库时,需要注意以下事项:

  1. 首先,安装必要的依赖项:

npm install leaflet@1.6.0 leaflet-timedimension@1.1.0

  1. 然后,在angular.json文件中加入以下代码:

"styles": [ "node_modules/leaflet/dist/leaflet.css", "node_modules/leaflet-timedimension/dist/leaflet.timedimension.control.css" ], "scripts": [ "node_modules/leaflet/dist/leaflet.js", "node_modules/leaflet-timedimension/dist/leaflet.timedimension.control.js" ]

  1. 最后,在组件中导入Leaflet和TimeDimension库,并初始化地图和时空控制器:

import * as L from 'leaflet'; import 'leaflet-timedimension';

...

ngOnInit() { const map = L.map('map').setView([51.505, -0.09], 13); const layer = L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', { attribution: '© OpenStreetMap contributors' }); layer.addTo(map);

const timeDimensionControl = L.control.timeDimension(); timeDimensionControl.addTo(map); }

通过以上步骤,可以解决Angular无法识别Leaflet TimeDimension的问题。

相关内容

热门资讯

透视了解!agpoker辅助(... 透视了解!agpoker辅助(透视)其实存在有辅助修改器(有挂技巧)-哔哩哔哩agpoker辅助能透...
事发当天!wepoker模拟器... 事发当天!wepoker模拟器哪个好用(透视)确实存在有辅助工具(有挂解惑)-哔哩哔哩1、超多福利:...
透视工具!来玩德州破解器(透视... 透视工具!来玩德州破解器(透视)果然是真的辅助辅助器(新版有挂)-哔哩哔哩1、许多玩家不知道来玩德州...
透视模拟器!wpk软件是真的吗... 透视模拟器!wpk软件是真的吗(透视)总是存在有辅助神器(有挂方式)-哔哩哔哩1、完成wpk软件是真...
透视教程!pokemmo脚本最... 透视教程!pokemmo脚本最新版(透视)真是存在有辅助平台(有挂规律)-哔哩哔哩1)pokemmo...
据统计!wepoker有没有透... 据统计!wepoker有没有透视方法(透视)原来真的是有辅助辅助器(的确有挂)-哔哩哔哩1、首先打开...
透视app!hhpoker软件... 透视app!hhpoker软件安装包(透视)一直真的有辅助插件(详细教程)-哔哩哔哩进入游戏-大厅左...
透视安装!菠萝辅助器免费版的功... 透视安装!菠萝辅助器免费版的功能介绍(透视)原来是有辅助神器(有挂解密)-哔哩哔哩运菠萝辅助器免费版...
透视教学!hhpoker德州牛... 透视教学!hhpoker德州牛仔视频(透视)竟然真的有辅助app(有挂透明挂)-哔哩哔哩1、进入到h...
昨日!hhpoker有后台操控... 昨日!hhpoker有后台操控吗(透视)好像真的有辅助修改器(有挂教程)-哔哩哔哩1、进入到hhpo...