Instantly share code, notes, and snippets.

@eirikb /mdl-vue.js
Last active May 24, 2017

Embed
What would you like to do?
Add MDL to all elements with "mdl-js"-class in Vue
import 'material-design-lite'
Vue.mixin({
mounted() {
if (!this.$el || !this.$el.querySelectorAll) return;
componentHandler.upgradeElement(this.$el);
for (const el of this.$el.querySelectorAll('[class*=mdl-js-]')) {
if (!el.dataset.upgraded) {
componentHandler.upgradeElement(el);
}
}
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment