Last active
March 21, 2019 12:53
-
-
Save hawkeye64/22012d402d2aebb0f0b816d4cef8f01f to your computer and use it in GitHub Desktop.
SVG Icon usage in Quasar
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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