美文网首页
NextJS开发:使用IconPark、Lucide图标库

NextJS开发:使用IconPark、Lucide图标库

作者: ArslanRobot | 来源:发表于2023-11-12 05:48 被阅读0次

    IconPark、Lucide两个很不错的图标库,如果需要用到微信、阿里等国内logo可以使用IconPark,Lucide中没有包含这些内容。

    安装IconPark

    npm install @icon-park/react --save
    

    简单使用

    import {Home} from '@icon-park/react';
    
    <Home/>
    <Home theme="filled"/>
    

    封装一下,避免每个页面导入,更换图标库也更方便

    import {Home} from '@icon-park/react';
    const Icons={
        home: Home
    }
    export default Icons;
    

    使用

    import Icons from "@/components/icons"
    
    export default function Test() {
        return (
            <Icons.home theme="filled" size="16"/>
        )
    }
    

    安装Lucide

    npm install lucide
    

    使用装Lucide

    import { 
      Users,
    } from "lucide-react";
    
    <Users/>
    

    相关文章

      网友评论

          本文标题:NextJS开发:使用IconPark、Lucide图标库

          本文链接:https://www.haomeiwen.com/subject/bmmlwdtx.html