Skip to content

Instantly share code, notes, and snippets.

@hawkeye64
Last active March 21, 2019 12:53
Show Gist options
  • Save hawkeye64/22012d402d2aebb0f0b816d4cef8f01f to your computer and use it in GitHub Desktop.
Save hawkeye64/22012d402d2aebb0f0b816d4cef8f01f to your computer and use it in GitHub Desktop.
SVG Icon usage in Quasar
Template Code:
<q-btn @click="home" >
<q-icon v-html="$options.filters.svg('home')" ></q-icon>
</q-btn>
Boot File:
Vue.filter("svg", function (code, options) {
options=Object.assign({
width : 20,
height : 26,
"class" : "svg-icon"
}, options );
return `<svg viewBox="0 0 65 65" height="${options.height}px" width="${options.height}px" class="${options.class}"><use xlink:href="#svg-icon-${code}" /></svg>`;
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment