mirror of
https://github.com/coreui/coreui-icons.git
synced 2025-08-21 07:51:21 +02:00
feat: add vue CIcon component and CIcon plugin containing all icons
This commit is contained in:
22
vue/CIcon.vue
Normal file
22
vue/CIcon.vue
Normal file
@@ -0,0 +1,22 @@
|
||||
<template>
|
||||
<svg width="64" height="64" v-html="computedCode"></svg>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: 'CIcon',
|
||||
icons: {},
|
||||
props: {
|
||||
iconCode: String,
|
||||
icon: String
|
||||
},
|
||||
mounted () {
|
||||
console.log(this.$options.icons)
|
||||
},
|
||||
computed: {
|
||||
computedCode () {
|
||||
return this.iconCode || this.$options.icons[this.icon]
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
12
vue/index.js
Normal file
12
vue/index.js
Normal file
@@ -0,0 +1,12 @@
|
||||
import Icons from '../js/iconsGenerated.js'
|
||||
import CIcon from './CIcon'
|
||||
|
||||
export { CIcon }
|
||||
|
||||
const VueCIconPlugin = {
|
||||
install (Vue) {
|
||||
CIcon.icons = Icons
|
||||
Vue.component('CIcon', CIcon)
|
||||
}
|
||||
}
|
||||
export { VueCIconPlugin }
|
Reference in New Issue
Block a user