vue-sprite
v1.2.0
Published
SVG Sprite
Downloads
20
Maintainers
Readme
➤ Install
yarn add vue-sprite
➤ Import
import AppIcon from 'vue-sprite'
➤ Use
main.js
import { createApp } from 'vue'
import AppIcon from 'vue-sprite'
import App from './App.vue';
const app = createApp(App)
app.component('AppIcon', AppIcon)
app.mount('#app')
The default path to the sprite file is './sprite.svg'
. You can pass your sprite file path:
AppIcon.props.file.default = 'my_file_path/my_file.svg'
sprite.svg
<svg id="sprite" aria-hidden="true" style="width: 0; height: 0; position: absolute;">
<symbol id="icon-one" viewBox="0 0 100 100">
<path ... />
</symbol>
<symbol id="icon-two" viewBox="0 0 100 100">
<path ... />
</symbol>
...
</svg>
Use icons in any app component
<AppIcon name="icon-one" />
➤ License
vue-sprite is released under MIT license