36 lines
797 B
HTML
36 lines
797 B
HTML
<!-- old browsers can't handle <use> very well -->
|
|
<svg
|
|
class={className}
|
|
{style}
|
|
aria-hidden={!ariaLabel}
|
|
aria-label={ariaLabel}
|
|
{viewBox}
|
|
ref:svg>
|
|
{@html html}
|
|
</svg>
|
|
<script>
|
|
import { animate } from '../_utils/animate'
|
|
import { store } from '../_store/store'
|
|
|
|
export default {
|
|
data: () => ({
|
|
className: '',
|
|
style: '',
|
|
ariaLabel: ''
|
|
}),
|
|
store: () => store,
|
|
computed: {
|
|
svgData: ({ href }) => process.env.ALL_SVGS[href],
|
|
html: ({ svgData }) => svgData.html,
|
|
viewBox: ({ svgData }) => svgData.viewBox
|
|
},
|
|
methods: {
|
|
animate (animation) {
|
|
const { reduceMotion } = this.store.get()
|
|
if (animation && !reduceMotion) {
|
|
animate(this.refs.svg, animation)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
</script>
|