I am utilizing a mixin in my Vue code to both add and override data properties. While I can successfully add new data, I am facing issues when trying to override existing data values. Below is a snippet of the code:
var mixin = {
data: function() {
return {
foo: 'boo',
test: 'blah'
}
}
}
var vm = new Vue({
el: '#vue-instance',
mixins: [mixin],
data: function() {
return {
foo: 'bar'
}
}
});
Upon running this code, 'test' retains its value as 'blah', however, 'foo' remains stuck at 'bar'. Is there any way to make a mixin override existing Vue data alongside adding new data?
For reference, here is a link to a live example on JSFiddle: