首页 > 解决方案 > 如何在节点中使用国家标志并做出反应

问题描述

我正在研究https://github.com/hjnilsson/country-flags

基本上指令说的只是npm install --save svg-country-flags

我做了,但我不确定如何在反应中显示正确的标志甚至标记或渲染方法的大小。

文档甚至提供了这个:http ://hjnilsson.github.io/country-flags/

通常有某种类似的 HTML/CSS <span className="icon au"></span>,但没有进一步的文档。任何想法?

标签: node.jsreactjs

解决方案


您可以尝试来自 IP2Location 的IP2Location ™ Country Flags,其中包含符合 ISO3166 标准的全球 249 个国家/地区的国旗图像。

通过链接到 ip2location-image-sprite.css,可以使用以下代码轻松调用国旗图像:

<i class="ip2location-flag-16 flag-au"></i>    //for au flag in 16px
<i class="ip2location-flag-32 flag-us"></i>    //for us flag in 32px

推荐阅读