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

vue-iconify

v1.0.10

Published

This is a component for introducing SVG icons in your Vue.js project, which allows you to easily integrate SVG icons into your application and add custom styles and animations to them.

Downloads

31

Readme

vue-iconify

English | 中文

这是一个用于在 Vue.js 项目中引入 SVG 图标的组件,它允许您轻松地将 SVG 图标集成到您的应用程序中,并向其添加自定义样式和动画。

当您使用 Icon 组件时,首先需要加载对应的字体图标。您可以通过在 HTML 文件的头部引入 Iconfont 字体文件来实现,如下所示:

<script src="https://at.alicdn.com/t/c/font_4066504_fxun8e8b6dt.js"></script>

上述代码插入了 阿里巴巴矢量图标库,并且通过 Symbol 的方式加载图标,之后我们的组件会根据提供的 Symbol 标签的 id 属性来填充图标内容。这种设计使得您可以轻松地在您的项目中使用图标,并根据需要进行自定义样式和大小调整。Icon 组件支持各种场景,让您的应用界面更加丰富多彩。

当然,除了 阿里巴巴矢量图标库 您也可以使用其他 图标库 或者通过 vite-plugin-html 插件去将 SVG 图标集成到您的项目中。

🗺 预览

Example

📦 安装

npm install vue-iconify -S

💡 使用

全局引入

// main.ts

import { createApp } from 'vue'
import App from './App.vue'
const app = createApp(App)

// ---开始---
import Icon from "vue-iconify"
app.use(Icon)
// ---结束---

app.mount('#app')
// tsconfig.json

{
  // ...其他配置
  "compilerOptions": {
    // ...其他配置
    "types": ["vue-iconify/global"],
  }
}

按需引入

import { Icon } from "vue-iconify"

示例

<template>
  <div id="Home">
    <Icon href="icon-logo" color="pink" size="30px" :stroke="{ color: 'red' }" />
  </div>
</template>

<script setup lang="ts">
import { Icon } from "vue-iconify"
</script>

🔩 Attributes

Props

| prop | description | type | default | | - | - | - | - | | href | 自定义 SVG 可不填 图标名 (id) | string | - | | color | 图标颜色 | string | 'currentColor' | | size | 图标大小 | string | '1em' | | stroke | 描边动画配置 | [StorkConfig] | - |

Props.StorkConfig

| prop | description | type | default | | - | - | - | - | | color | (必填) 描边颜色 | string | - | | width | 描边宽度 | string | '10px' | | lineJoin | 描边线条连接方式 | "inherit" | "miter" | "round" | "bevel" | 'round' | | lineCap | 描边线条末端方式 | "inherit" | "round" | "butt" | "square" | 'round' | | transition | 过渡效果 | [TransitionConfig] | - |

Props.TransitionConfig

| prop | description | type | default | | - | - | - | - | | duration | 指定过渡的持续时间 | string | '1s' | | timingFunction | 指定转换的计时函数 | string | 'ease' | | delay | 指定转换开始之前的延迟 | string | '0s' |

🎍 Slots

自定义 SVG - 示例:

<template>
  <div id="Example">
    <Icon
      color='pink'
      size="100px"
      :stroke="{ color:'red', width: '30', duration: '3s' }"
    >
      <svg
        viewBox="0 0 1024 1024"
        version="1.1"
        xmlns="http://www.w3.org/2000/svg"
        p-id="3085"
        width="128"
        height="128"
      >
        <path
          d="M250.6 686l598.1-460.5-500.7 513v166.1l111.8-122.4 263.8 122.4 236.7-784.1-896.1 469L250.6 686z"
          p-id="3086"
        ></path>
      </svg>
    </Icon>
  </div>
</template>