Answer the question
In order to leave comments, you need to log in
Overriding mixins in vue.js?
Hello.
There is a component that is installed using npm. It uses a mixin that doesn't work for me.
Is it possible to override the mixin that is used in this component without copying the code of the entire component?
Answer the question
In order to leave comments, you need to log in
Try like this.
import BaseGrid from './Grid.vue';
import MyMixin from './MyMixin.js';
const TransformedGrid = Vue.component('BaseGrid').extend({
mixins: ['MyMixin']
});
export default {
name: 'SomeComponent',
components: {
BaseGrid: TransformedGrid
}
}
import BaseGrid from './Grid.vue';
import MyMixin from './MyMixin.js';
const TransformedGrid = Vue.component('BaseGrid').extend({
mixins: ['MyMixin']
});
export default {
install (Vue) {
Vue.component('Grid', TransformedGrid)
}
}
import Grid from './installCustomGrid.js';
Vue.use(Grid);
methods: {
getWindowSize () {}
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question