2
0
mirror of https://github.com/tenrok/vue-tribute.git synced 2026-06-20 03:10:35 +03:00
Files
vue-tribute/dist/vue-tribute.es.js
T
2019-02-08 15:33:20 -05:00

39 lines
832 B
JavaScript

import Tribute from 'tributejs';
var VueTribute = {
name: "vue-tribute",
props: {
options: {
type: Object,
required: true
}
},
mounted: function mounted() {
if (typeof Tribute === "undefined") {
throw new Error("[vue-tribute] cannot locate tributejs!");
}
var $el = this.$slots.default[0].elm;
this.tribute = new Tribute(this.options);
this.tribute.attach($el);
},
beforeDestroy: function beforeDestroy() {
var $el = this.$slots.default[0].elm;
if (this.tribute) {
this.tribute.detach($el);
}
},
render: function render(h) {
return h("div", {
staticClass: "v-tribute"
}, this.$slots.default);
}
};
if (typeof window !== "undefined" && window.Vue) {
window.Vue.component(VueTribute.name, VueTribute);
}
export default VueTribute;