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

@ophiuchus/icon

v1.0.2

Published

### 介绍

Downloads

14

Readme

Icon 图标

介绍

基于字体的图标集,可以通过 Icon 组件使用,也可以在其他组件中通过 icon 属性引用。

引入

import Vue from 'vue';
import Icon from "@ophiuchus/icon";

Vue.use(Icon);

代码演示

基础用法

Iconname 属性支持传入图标名称或图片链接,所有可用的图标名称见右侧示例。

<sf-icon name="like-o" />
<sf-icon name="https://img3.tuhu.org/3rq0A7JtvChtaD5QMO3HgA_w98_h78.png" />

徽标提示

设置 dot 属性后,会在图标右上角展示一个小红点;设置 badge 属性后,会在图标右上角展示相应的徽标。

<sf-icon name="like-o" dot />
<sf-icon name="like-o" badge="9" />
<sf-icon name="like-o" badge="99+" />

图标颜色

Iconcolor 属性用来设置图标的颜色。

<sf-icon name="star-o" color="#1989fa" />
<sf-icon name="like-o" color="#ee0a24" />

图标大小

Iconsize 属性用来设置图标的尺寸大小,默认单位为 px

<sf-icon name="like-o" size="40" /> <sf-icon name="like-o" size="3rem" />

自定义图标

如果需要在现有 Icon 的基础上使用更多图标,可以引入第三方 iconfont 对应的字体文件和 CSS 文件,之后就可以在 Icon 组件中直接使用。

/* 引入第三方或自定义的字体图标样式 */
@font-face {
  font-family: 'my-icon';
  src: url('./my-icon.ttf') format('truetype');
}

.my-icon {
  font-family: 'my-icon';
}

.my-icon-extra::before {
  content: '\e626';
}
<!-- 通过 class-prefix 指定类名为 my-icon -->
<sf-icon class-prefix="my-icon" name="extra" />

API

Props

| 参数 | 说明 | 类型 | 默认值 | | --- | --- | --- | --- | | name | 图标名称或图片链接 | string | - | | dot | 是否显示图标右上角小红点 | boolean | false | | badge | 图标右上角徽标的内容 | number | string | - | | color | 图标颜色 | string | inherit | | size | 图标大小,如 20px 2em,默认单位为px | number | string | inherit | | class-prefix | 类名前缀,用于使用自定义图标 | string | sf-icon | | tag | HTML 标签 | string | i |

Events

| 事件名 | 说明 | 回调参数 | | ------ | -------------- | -------------- | | click | 点击图标时触发 | event: Event |