openlayers6:css与js引入[笔记]

笔记

在项目中时遇到ol的css和js无法使用,换版本引入新的js和css文件,共两种解决方法:

一.直接使用网络资源

可以直接在js中引入网络资源

<script src="https://cdn.jsdelivr.net/gh/openlayers/openlayers.github.io@master/en/v6.9.0/build/ol.js"></script>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/openlayers/openlayers.github.io@master/en/v6.9.0/css/ol.css">

二.将js和css文件下载至本地

js文件访问复制下载到本地
css文件访问复制下载至本地

猜你喜欢

转载自blog.csdn.net/mcband/article/details/127838550