2
0
mirror of https://github.com/frappe/books.git synced 2024-12-26 04:17:36 +00:00

fix: Use h to create component

This commit is contained in:
Faris Ansari 2019-11-15 13:16:10 +05:30
parent 4071a6e8bc
commit 03dee5913c

View File

@ -1,6 +1,3 @@
<template>
<div class="feather-icon" v-html="iconSVG"></div>
</template>
<script> <script>
import feather from 'feather-icons'; import feather from 'feather-icons';
@ -14,33 +11,32 @@ export default {
validator(value) { validator(value) {
const valid = validIcons.includes(value); const valid = validIcons.includes(value);
if (!valid) { if (!valid) {
console.warn(`name property for feather-icon must be one of `, validIcons); console.warn(
`name property for feather-icon must be one of `,
validIcons
);
} }
return valid; return valid;
} }
},
size: {
type: Number,
default: 16
} }
}, },
computed: { render(h) {
iconSVG() { let icon = feather.icons[this.name];
const icon = feather.icons[this.name]; return h('svg', {
if (!icon) { attrs: Object.assign({}, icon.attrs, {
return ''; fill: 'none',
stroke: 'currentColor',
'stroke-linecap': 'round',
'stroke-linejoin': 'round',
'stroke-width': 1.5,
width: null,
height: null
}),
class: [icon.attrs.class],
domProps: {
innerHTML: icon.contents
} }
return icon.toSvg({
width: this.size,
height: this.size
}); });
} }
} };
}
</script> </script>
<style>
.feather-icon {
display: inline-flex;
}
</style>