npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

taro3-vue3-iconfont

v1.2.6

Published

taro3-vue3-iconfont

Readme

taro3-vue3-iconfont

taro3 + vue3 + volar项目中使用iconfont,支持weapph5

Step1

安装:

# yarn
yarn add taro3-vue3-iconfont -D

# npm
npm i taro3-vue3-iconfont -D

Step2

方式一:去iconfont官网点击下载至本地,将其中的iconfont.js拷贝到项目中

方式二:去iconfont官网获取symbol链接,请直接复制iconfont官网提供的项目链接。请务必看清是.js后缀而不是.css后缀。如果你现在还没有创建iconfont的仓库,那么可以填入这个链接去测试://at.alicdn.com/t/font_3348788_knd7fx1tclm.js Image

Step3

配置package.json

  1. 增加taro3-vue3-iconfont选项,接收一个数组支持引入多个iconfont项目,url值为iconfont.js文件相对路径iconfont symbol链接,output为组件输出目录,componentName设置组件名称
  2. build命令前增加taro3-vue3-iconfont

插件会读取配置的urloutput目录下生成相应的图标组件,并在每次启动或者构建前,会根据url的变化自动更新

{
  "scripts": {
    "dev:weapp": "npm run build:weapp -- --watch",
    "dev:h5": "npm run build:h5 -- --watch",
    "build:weapp": "taro3-vue3-iconfont && taro build --type weapp",
    "build:h5": "taro3-vue3-iconfont && taro build --type h5",
  },
  "taro3-vue3-iconfont": [
    {
      "url": "//at.alicdn.com/t/font_3348788_knd7fx1tclm.js",
      "output": "./src/icon",
      "componentName": "Iconfont"
    },
    {
      "url": "./other-iconfont/iconfont.js",
      "output": "./src/other-iconfont",
      "componentName": "OtherIconfont"
    }
  ]
}

taro3-vue3-iconfont选项 | 属性名 | 描述 | 类型 | 默认值 | | --- | --- | --- | --- | | url | 必须,去iconfont官网获取symbol链接 | string | - | | output | 必须,组件的输出路径 | string | - | | componentName | 可选,注册的组件名称,插件会进行大驼峰转换 | string | 默认为设置的iconfont库的Symbol前缀,可以在iconfont项目设置中查看,例如Symbol前缀为iconfont-,那么组件名称就是iconfont的大驼峰表示Iconfont |

Step4

在入口app.js中全局注册图标组件

const App = createApp({
  onShow(options) {},
  // 入口组件不需要实现 render 方法,即使实现了也会被 taro 所覆盖
});

// 注册Iconfont组件
import Iconfont from './icon';
App.use(Iconfont);

Step5

使用组件

| 属性名 | 描述 | 类型 | 默认值 | | --- | --- | --- | --- | | name | icon名称 | string | - | | size | icon尺寸,不要单位,基于Taro.config.designWidth计算,默认为750设计稿的32px | string/number | 32 | | fill | 颜色值 | string | currentColor |

<template>
  <Iconfont name="iconfont-iconfont5" size="24" fill="red" />
</template>

配合volar,组件的类型提示

Image

Image

参考项目:

taro-iconfont-cli