Someone knows how inherit a mixin
with its template? or how to inject dinamically elements or components from a mixin
?
EDIT: I don't want to modify greeting component, I have two Mixins: 404Mixin that adds a method raise404() and show a 100% layer and LoaderMixin that have loading() method that shows a spinner in the corner. I can inherit their methods, but I have to duplicate the html in every component that I want to use it.
Thanks
mixin = {
template: '<p>{{ foo }}</p>',
data() {
return {
foo: 'Hello',
};
},
}
// This should be <div><p>Hello</p><p>World!</p></div>
Vue.component('greeting', {
mixins: [mixin],
template: '<div><p>World!</p></div>'
});
var vm = new Vue({
el: '#app'
});
<script src="https://cdn.jsdelivr.net/vue/1.0.16/vue.js"></script>
<div id="app">
<greeting></greeting>
</div>
<div><p>Hello</p><p>World!</p></div>
, I have a more complex code, but I've created the example code to represent the problem.