# Vue-Awesome
> Awesome SVG icon component for Vue.js, with built-in Font Awesome icons.
> [ð¨ð³ ä¸æç](./README.zh_CN.md)
Vue-Awesome an SVG icon component for [Vue.js](https://vuejs.org/), with built-in icons courtesy of [Font Awesome](https://fontawesome.com/).
Check out the demo [here](https://justineo.github.io/vue-awesome/demo/).
## Installation
### npm (Recommended)
```bash
$ npm install vue-awesome
```
### bower
```bash
$ bower install vue-awesome
```
### Manual
Just download `dist/vue-awesome.js` and include it in your HTML file:
```html
<script src="path/to/vue-awesome/dist/vue-awesome.js"></script>
```
## Usage
```html
<!-- basic -->
<v-icon name="beer"/>
<!-- with options -->
<v-icon name="sync" scale="2" spin/>
<v-icon name="comment" flip="horizontal"/>
<v-icon name="code-branch" label="Forked Repository"/>
<!-- stacked icons -->
<v-icon label="No Photos">
<v-icon name="camera"/>
<v-icon name="ban" scale="2" class="alert"/>
</v-icon>
```
Font Awesome 5 has separated all icons into several packs. Vue-Awesome is built upon its all free icons, which includes all free icons from 3 icon packs: `regular`, `solid` and `brands`. Since the `solid` pack has the most number of icons, we organize all Vue-Awesome icons as follows:
* All icons from `solid` pack are located in `vue-awesome/icons` directory and have unprefixed `name` prop values.
* Icons from `regular` and `brands` are located in `vue-awesome/icons/regular` and `vue-awesome/icons/brands`, which have prefixed `name` prop values like `regular/flag` or `brands/reddit`.
You can find all available `name` values from [Font Awesome's website](https://fontawesome.com/icons) like `beer`, `file` and `camera`.
### ES Modules with NPM & vue-loader (Recommended)
```js
import Vue from 'vue'
/* Pick one way between the 2 following ways */
// only import the icons you use to reduce bundle size
import 'vue-awesome/icons/flag'
// or import all icons if you don't care about bundle size
import 'vue-awesome/icons'
/* Register component with one of 2 methods */
import Icon from 'vue-awesome/components/Icon'
// globally (in your main .js file)
Vue.component('v-icon', Icon)
// or locally (in your component file)
export default {
components: {
'v-icon': Icon
}
}
```
#### â ï¸ Heads up
##### Importing the souce version
If you are using official Vue CLI to create your project and you want to use the untranspiled component (import `vue-awesome/components/Icon` rather than import `vue-awesome` directly, to optimize bundle size, which is recommended), you'll encounter the problem that the default configuration will exclude `node_modules` from files to be transpiled by Babel.
For **Vue CLI 3+**, add `vue-awesome` into `transpileDependencies` in `vue.config.js` like this:
```js
// vue.config.js
module.exports = {
transpileDependencies: [
/\bvue-awesome\b/
]
}
```
For **Vue CLI 2** with the `webpack` template, modify `build/webpack.base.conf.js` like this:
```diff
{
test: /\.js$/,
loader: 'babel-loader',
- include: [resolve('src'), resolve('test')]
+ include: [
+ resolve('src'),
+ resolve('test'),
+ resolve('node_modules/vue-awesome')
+ ]
}
```
If you are using bare webpack config, just do similar modifications make it work.
#### Using with Nuxt.js
When using Vue-Awesome on the server side with Nuxt.js, it may prompt `Unexpected token import` because Nuxt.js has configured an `external` option by default, which prevent files under `node_modules` from being bundled into the server bundle with only a few exceptions. We need to whitelist `vue-awesome` in `nuxt.config.js` as follows:
For **Nuxt.js 2**:
```js
module.exports = {
// ...
build: {
transpile: [/^vue-awesome/]
}
}
```
For **Nuxt.js 1**:
```js
// Don't forget to
// npm i --save-dev webpack-node-externals
const nodeExternals = require('webpack-node-externals')
module.exports = {
// ...
build: {
extend (config, { isServer }) {
// ...
if (isServer) {
config.externals = [
nodeExternals({
// default value for `whitelist` is
// [/es6-promise|\.(?!(?:js|json)$).{1,5}$/i]
whitelist: [/es6-promise|\.(?!(?:js|json)$).{1,5}$/i, /^vue-awesome/]
})
]
}
}
}
}
```
##### Unit Testing with Jest
Make sure to whitelist `vue-awesome` from the `transformIgnorePattern`. Add following configuation in `test/unit/jest.conf.js`:
```diff
+ transformIgnorePatterns: [
+ '/node_modules(?![\\\\/]vue-awesome[\\\\/])/'
+ ],
```
*Don't import all icons if you don't want to make unit testing slow because this will transform all icons from ES module and thus slow down the test process.*
### CommonJS with NPM without ES Next support
```js
var Vue = require('vue')
// requiring the UMD module
var Icon = require('vue-awesome')
// or with vue-loader you can require the src directly
var Icon = require('vue-awesome/components/Icon')
// register component to use
```
### AMD
```js
require.config({
paths: {
'vue-awesome': 'path/to/vue-awesome'
}
})
require(['vue-awesome'], function (Icon) {
// register component to use
Vue.component('v-icon', Icon)
})
```
### Global variable
The component class is exposed as `window.VueAwesome`.
```js
// register component to use
Vue.component('v-icon', VueAwesome)
```
### Props
* `name: string`
The name of the icon. It's necessary if the component isn't used as the wrapper of an icon stack. All valid names correspond to the file path relative to the `icons` directory. Notice that you may have to check the name of the icon pack after you search on FontAwesome's website. For example, you'll see a URL argument of `style=brands` on the [detail page for `500px`](https://fontawesome.com/icons/500px?style=brands) and the icon name will be `brands/500px`.
Only free icons for FontAwesome are available by default and because the `solid` style has the most icons, we've made it the default pack so the path prefixes can be omitted.
If you pass `null` to this prop, the whole component will not be rendered.
* `scale: number|string`
Used to adjust the size of the icon. Default to `1`.
* `spin: boolean`
Used to specify whether the icon is spining. Default to `false`. (Can't use together with `pulse`.)
* `pulse: boolean`
Set the pulse effect to the icon. Default to `false`. (Can't use together with `spin`.)
* `inverse: boolean`
If set to `true`, the color of the icon will become `#fff`. Default to `false`.
* `flip: 'vertical'|'horizontal'|'both'`
Used to flip the icon.
* `label: string`
Set the `aria-label` for the icon if provided.
* `title: string`
Set the title for the icon.
> The icon will have `role="presentation"` thus not accessible when neither `label` nor `title` exists.
### Misc
If you are using `vue-awesome/components/Icon` (instead of the whole bundled version), Vue-Awesome won't import a single icon by default. Do not forget to import icons you want to use.
If these caveats don't help and there are no proper workarounds in [earlier issues](https://github.com/Justineo/vue-awesome/issues?utf8=%E2%9C%93&q=is%3Aissue), please feel free to [file a new one](https://github.com/Justineo/vue-awesome/issues/new).
## Styling
### Dynamic sizing
You can make the icons scale dynamically according to your `font-size` by adding the following CSS:
```css
.fa-icon {
width: auto;
height: 1em; /* or any other relative font sizes */
/* You would have to include the following two lines to make this work in Safari */
max-width: 100%;
max-height: 100%;
}
```
### Colors
The icon color is inherited from the font color of the parent element by default. You can easily change it to any other color by specifying the `color` property.
## Local development
```bash
$ npm i
$ npm run dev
```
Open `http://localhost:8080/demo` to see the demo.
### Updating icons
Don'
没有合适的资源?快使用搜索试试~ 我知道了~
适用于 Vue.js 的超棒 SVG 图标组件,内置 Font Awesome 图标 .zip
共1703个文件
js:1621个
svg:59个
md:3个
1.该资源内容由用户上传,如若侵权请联系客服进行举报
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
版权申诉
0 下载量 166 浏览量
2024-12-01
20:56:16
上传
评论
收藏 2.78MB ZIP 举报
温馨提示
Vue-Awesome适用于 Vue.js 的超棒 SVG 图标组件,带有内置 Font Awesome 图标。 中文版Vue-Awesome 是Vue.js的一个 SVG 图标组件,带有由Font Awesome提供的内置图标。在此处查看演示。安装npm(推荐)$ npm install vue-awesome凉亭$ bower install vue-awesome手动的只需下载dist/vue-awesome.js并将其包含在您的 HTML 文件中<script src="path/to/vue-awesome/dist/vue-awesome.js"></script>用法<!-- basic --><v-icon name="beer"/><!-- with options --><v-icon name="sync" scale="2" spin/><v-icon name="comment" flip="horizontal"/><v-icon name="code-branch" label="Forked Repo
资源推荐
资源详情
资源评论
收起资源包目录
适用于 Vue.js 的超棒 SVG 图标组件,内置 Font Awesome 图标 .zip (1703个子文件)
app.48fe9109.css 10KB
.editorconfig 147B
.eslintignore 33B
.gitignore 601B
.gitkeep 0B
index.html 534B
index.html 496B
vue-awesome.js 1.13MB
app.e69e3e4c.js 1.12MB
chunk-vendors.9f71b8db.js 108KB
index.js 38KB
old-republic.js 9KB
critical-role.js 7KB
wizards-of-the-coast.js 7KB
reacteurope.js 7KB
the-red-yeti.js 6KB
grunt.js 6KB
mandalorian.js 5KB
optin-monster.js 5KB
rust.js 5KB
d-and-d.js 5KB
jenkins.js 4KB
fort-awesome-alt.js 4KB
salesforce.js 4KB
d-and-d-beyond.js 4KB
raspberry-pi.js 4KB
amazon-pay.js 4KB
bacteria.js 4KB
linux.js 4KB
cc-amazon-pay.js 4KB
node.js 3KB
cc-amex.js 3KB
ussunnah.js 3KB
cc-mastercard.js 3KB
mailchimp.js 3KB
sass.js 3KB
main.js 3KB
.eslintrc.js 3KB
react.js 3KB
gulp.js 3KB
phoenix-framework.js 3KB
safari.js 3KB
cogs.js 3KB
themeisle.js 2KB
soundcloud.js 2KB
battle-net.js 2KB
fedora.js 2KB
galactic-senate.js 2KB
meetup.js 2KB
connectdevelop.js 2KB
aviato.js 2KB
border-none.js 2KB
wolf-pack-battalion.js 2KB
ember.js 2KB
aws.js 2KB
truck-monster.js 2KB
bacterium.js 2KB
firefox.js 2KB
fa2svg.js 2KB
earlybirds.js 2KB
stroopwafel.js 2KB
lungs-virus.js 2KB
angrycreative.js 2KB
ns8.js 2KB
less.js 2KB
shirtsinbulk.js 2KB
viruses.js 2KB
laravel.js 2KB
empire.js 2KB
cc-paypal.js 2KB
pastafarianism.js 2KB
supple.js 2KB
apper.js 2KB
pied-piper-alt.js 2KB
uncharted.js 2KB
keybase.js 2KB
hands-wash.js 2KB
journal-whills.js 2KB
sticker-mule.js 2KB
users-cog.js 2KB
grav.js 2KB
tty.js 2KB
dharmachakra.js 2KB
fingerprint.js 2KB
american-sign-language-interpreting.js 2KB
dungeon.js 2KB
shower.js 2KB
car-crash.js 2KB
snowflake.js 2KB
firefox-browser.js 2KB
github-square.js 2KB
hanukiah.js 2KB
hooli.js 2KB
google-pay.js 2KB
biohazard.js 2KB
keycdn.js 2KB
snowflake.js 2KB
jedi.js 2KB
nutritionix.js 2KB
hand-sparkles.js 2KB
共 1703 条
- 1
- 2
- 3
- 4
- 5
- 6
- 18
资源评论
徐浪老师
- 粉丝: 8585
- 资源: 1万+
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- 19 工资发放明细表-可视化图表.xlsx
- 27 员工工资表(图表分析).xlsx
- 23 财务报告工资数据图表模板.xlsx
- 22 财务报告工资数据图表模板.xlsx
- 24 工资表-年度薪资可视化图表.xlsx
- 26 财务分析部门工资支出图表.xlsx
- Python爬虫技术详解:从基础到实战.zip
- 25 工资费用支出表-可视化图表.xlsx
- 30公司各部门工资支出数据图表1.xlsx
- 29 员工月度工资支出数据图表.xlsx
- 28 工资表(自动计算,图表显示).xlsx
- 31 财务分析工资年度开支图表.xlsx
- 33 年度工资预算表(可视化看板).xlsx
- 32 公司年度工资成本数据图表.xlsx
- 34 年度工资汇总-数据可视化看板.xlsx
- 36 财务报表新年度部门工资预算表.xlsx
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功