我是否需要导入传单的CSS文件? [英] Do I have to import leaflet's CSS file?

查看:68
本文介绍了我是否需要导入传单的CSS文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用带有传单的Node/React/Webpack.我使用npm安装了传单,并在地图组件中导入了传单";对于js来说效果很好.

I'm using Node / React / Webpack with leaflet. I installed leaflet using npm and in my map component I import 'leaflet'; which works fine for the js.

但是,由于css无法正常工作,地图看起来不正确,但是存储在传单/dist/图像中的图像似乎可以正常工作.为了使css正常工作,我还必须导入'leaflet/dist/leaflet.css',但在我看来我不必这样做,并且应该将其包含在第一个import语句中?

However, the map does not look correct due to the css not working correctly, however images stored in the leaflet/dist/images seem to work fine. In order to get the css to work I have to also import 'leaflet/dist/leaflet.css' but it feels to me like I shouldn't have to and that it should be included with the first import statement?

推荐答案

是的,请参阅以下链接:

Yes you have to have, see this link might be useful:

leaflet-css Webpack要求

我在ionic项目中省略了它的css,但是复制了一些必要的行,以避免损坏地图ui.

I omitted its css in an ionic project but coppied a few necessary lines to avoid broken map ui.

这篇关于我是否需要导入传单的CSS文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆