2
0
mirror of https://github.com/tenrok/vue-tribute.git synced 2026-06-20 12:50:34 +03:00
Files
vue-tribute/dist/vue-tribute.cjs.js
T
2018-03-25 15:57:36 -04:00

45 lines
1.0 KiB
JavaScript

'use strict';
function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; }
var Tribute = _interopDefault(require('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);
}
module.exports = VueTribute;