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 🙏

© 2024 – Pkg Stats / Ryan Hefner

vi-icon

v0.0.3

Published

微信小程序图标库组件

Downloads

4

Readme

vi-icon

组件效果预览

image

使用

npm i vi-icon --save

使用微信开发者工具构建NPM并使用NPM模块

"usingComponents": {
  "ViIcon": "vi-icon",
}

示例

使用内置图标

iconName接收内置的图标名称

icon-style 用于定义图标的样式

<template>
  <ViIcon iconName="email" icon-style="vi-icon-email"></ViIcon>
</template>

如果要定义图标的字体大小,请给类名加上 before伪元素

内置图标的字体大小为14px

.vi-icon-email::before {
  font-size: 30px;
  color: red;
}

扩展图标库

使用图标库扩展功能请先阅读微信小程序的字体API

fontSource 接收图标库的资源文件。文件类型为 .ttf或者 .woff

<template>
  <ViIcon 
    fontSource="url('https://at.alicdn.com/t/font_629189_c2m154yp2ts.ttf')" 
    icon-style="icon-local">
  </ViIcon>
</template>

content 中的内容为字体的 unicode 编码

.icon-local::before {
  content: '\e602';
  font-size: 20px;
}

修改扩展图标的fontFamily

fontFamily 用于修改字体文件的css引用名称

<template>
  <ViIcon 
    fontSource="url('https://at.alicdn.com/t/font_849474_p1bye6fkj5.woff')" 
    icon-style="icon-network-error"
    fontFamily="viAbnormalTips">
  </ViIcon>
</template>
.icon-network-error::before {
  content: '\e602';
  font-size: 66px;
}

全局配置扩展图标的文件资源

如果是使用全局配置,请在app.js的options对象上挂载_$ViIcon配置信息

// app.js
App({
  onLaunch: function () {
  },
  ...serverData,
  globalData: {
    userInfo: null
  },
  _$ViIcon: {
    fontSource: 'url("https://at.alicdn.com/t/font_629189_c2m154yp2ts.ttf")',
    fontFamily: 'man-rong' // 可选项,如果不填,fontFamily为custom-fon
  }
})

如果是全局配置过了字体文件资源,那么只需要定义icon的样式即可

<template>
  <ViIcon 
    icon-style="icon-carams">
  </ViIcon>
</template>
.icon-carams::before {
  content: '\e603';
  color: aqua;
  font-size: 44px;
}

Config Props

| 接口 | 数据类型 | 说明 | 选项 | 默认值 | 版本号 | | :--: | :--: | :--: | :--: | :--: | :--: | | iconName | String | 组件内容的icon名称 | 选填 | '' | 0.0.1 | | fontFamily | String | 扩展的字体资源名称设置 | 选填 | custom-font | 0.0.1 | | fontSource | String | 字体的资源路径需要为 | 选填 | '' | 0.0.1 |

Extend Class

| prop | 说明 | | :--: | :--: | | icon-style | 用于设置字体图标的样式 |

Event name

| Event name | 说明 | | :--: | :--: | | clickIcon | 组件点击事件 |

Global Config Props

| 接口 | 数据类型 | 说明 | 选项 | 默认值 | 版本号 | | :--: | :--: | :--: | :--: | :--: | :--: | | _$ViIcon | Object | 字体资源文件的相关配置 | 选填 | {} | 0.0.3 |

Icon Name 内置的图标名

| icon name | icon name | icon name | | :--: | :--: | :--: | | email | shooping | location | | cloud-download | cloud-upload | branch | | data | telephone | share | | price | full-screen | full-screen-cancel | | delete | qrCode | setting | | setting-cente | control | return | | link | link-cancel | shopping-case | | label | print | bluetooth | | add | reduce | right | | error | refresh | history | | bottom-left-arrow | bottom-right-arrow | top-right-arrow | | top-left-arrow | right-arrow | left-arrow | | bottom-arrow | top-arrow | bottom-arrow-doubl | | top-arrow-double | right-arrow-double | right-arrow-double | | left-arrow-double | - | - |

版本记录

  • v0.0.1 初始版本
  • v0.0.3 新增全局配置外部字体文件功能