2
0
mirror of https://github.com/tenrok/vue-tribute.git synced 2026-06-21 10:30:35 +03:00
Files
vue-tribute/dist/vue-tribute.es.js
T
2018-03-25 15:57:36 -04:00

41 lines
878 B
JavaScript

import Tribute from 'tributejs';
var VueTribute = {
name: 'vue-tribute',
props: {
options: {
type: Object,
required: true
}
},
data: function data() {
return {
tribute: null
};
},
mounted: function mounted() {
var _this = this;
var $el = this.$slots.default[0].elm;
this.tribute = new Tribute(this.options);
this.tribute.attach($el);
$el.addEventListener('tribute-replaced', function (e) {
_this.$emit('tribute-replaced', e);
});
$el.addEventListener('tribute-no-match', function (e) {
_this.$emit('tribute-no-match', e);
});
},
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;