Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/qinshenxue/vue-icon

Maybe it is the smallest vue component that contains all the feather icons
https://github.com/qinshenxue/vue-icon

feather feather-icons icons svg vue-component vue-feathers vue-icon vue2 vue2-component

Last synced: 3 days ago
JSON representation

Maybe it is the smallest vue component that contains all the feather icons

Awesome Lists containing this project

README

        

# vue-icon
[![https://img.shields.io/npm/v/vue-icon.svg](https://img.shields.io/npm/v/vue-icon.svg)](https://www.npmjs.com/package/vue-icon)
[![https://img.shields.io/npm/dm/vue-icon.svg](https://img.shields.io/npm/dm/vue-icon.svg)](https://www.npmjs.com/package/vue-icon)
![https://img.shields.io/npm/l/vue-icon.svg](https://img.shields.io/npm/l/vue-icon.svg)

> vue2 svg icon component

Maybe it is the smallest vue component library that contains all the feather icons

# Icons
[https://qinshenxue.github.io/vue-icon/](https://qinshenxue.github.io/vue-icon/)

# Usage
using npm
``` shell
$ npm install vue-icon
```
The default component name is icon, you can specify a new component name with `Vue.use(plugin,customName)`.
```js
import Vue from 'vue';
import App from './app.vue';
import feather from 'vue-icon'
Vue.use(feather, 'v-icon')
new Vue({
el: '#app',
render: h => h(App)
});
```
Or configure an object to change the name and the default icon class.
```js
Vue.use(feather, {
name: 'v-icon',
props: {
baseClass: {
type: String,
default: 'v-icon'
},
classPrefix: {
type: String,
default: 'v-icon-'
}
}
})
// or
Vue.use(feather, {
name: 'v-icon',
data(){
return {
baseClass: 'v-icon',
classPrefix: 'v-icon-'
}
}
})
```
The configured objects are treated as [mixins](https://vuejs.org/v2/api/index.html#mixins), so you can define it like normal Vue instance objects.

using in `.vue` file
``` xml





import customIcon from 'vue-icon/lib/vue-feather.esm'
export default{
components: {
customIcon
},
data: function () {
return {
baseClass: 'v-icon'
}
}
}

.v-icon,
.custom-icon {
width: 24px;
}

```

Or using script tag
``` xml

```

## Icon Style
Components don't contain any style definitions, you can define styles based on `baseClass:'icon'` and `classPrefix:'icon-'`.
``` css
.icon{
color:#666
}
.icon:hover{
color:#000
}
.icon-close{
color:red
}
```

# Component Attributes

| Attribute | Description | Type | Default |
| ------------- | ------------- |:-------------:| :-------------:|
| name | The name of icon | string | -- |
| base-class | icon base class | string | icon |
| class-prefix | icon class prefix | string | icon- |

# Changelog
Detailed changes for each release are documented in the release notes.