
Product
Introducing Repository Access Permissions and Custom Roles
Socket now supports Custom Roles and Repository Access Permissions so organizations can control who can access specific repositories and actions.
@ophiuchus/icon
Advanced tools
基于字体的图标集,可以通过 Icon 组件使用,也可以在其他组件中通过 icon 属性引用。
import Vue from 'vue';
import Icon from "@ophiuchus/icon";
Vue.use(Icon);
Icon 的 name 属性支持传入图标名称或图片链接,所有可用的图标名称见右侧示例。
<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+" />
Icon 的 color 属性用来设置图标的颜色。
<sf-icon name="star-o" color="#1989fa" />
<sf-icon name="like-o" color="#ee0a24" />
Icon 的 size 属性用来设置图标的尺寸大小,默认单位为 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" />
| 参数 | 说明 | 类型 | 默认值 |
|---|---|---|---|
| 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 |
| 事件名 | 说明 | 回调参数 |
|---|---|---|
| click | 点击图标时触发 | event: Event |
FAQs
### 介绍
We found that @ophiuchus/icon demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Product
Socket now supports Custom Roles and Repository Access Permissions so organizations can control who can access specific repositories and actions.

Product
Socket MCP now lets AI assistants review org alerts, investigate threats using the Socket threat feed, and inspect package files in addition to dependency scoring.

Product
Socket Firewall blocks malicious VS Code and Open VSX extensions before install, protecting developers from compromised editor marketplaces.