mirror of
https://github.com/frappe/books.git
synced 2024-11-10 15:50:56 +00:00
43 lines
906 B
Vue
43 lines
906 B
Vue
|
<template>
|
||
|
<div class="feather-icon" v-html="iconSVG"></div>
|
||
|
</template>
|
||
|
<script>
|
||
|
import feather from 'feather-icons';
|
||
|
|
||
|
const validIcons = Object.keys(feather.icons);
|
||
|
|
||
|
export default {
|
||
|
props: {
|
||
|
name: {
|
||
|
type: String,
|
||
|
required: true,
|
||
|
validator(value) {
|
||
|
const valid = validIcons.includes(value);
|
||
|
if (!valid) {
|
||
|
console.warn(`name property for feather-icon must be one of `, validIcons);
|
||
|
}
|
||
|
return valid;
|
||
|
}
|
||
|
},
|
||
|
size: {
|
||
|
type: Number,
|
||
|
default: 16
|
||
|
}
|
||
|
},
|
||
|
computed: {
|
||
|
iconSVG() {
|
||
|
return feather.icons[this.name].toSvg({
|
||
|
width: this.size,
|
||
|
height: this.size
|
||
|
});
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
</script>
|
||
|
<style>
|
||
|
.feather-icon {
|
||
|
display: inline-block;
|
||
|
}
|
||
|
</style>
|
||
|
|