When extended Vue and adding additional methods, howcome it's not possible to call from outside the instance?
// mixin.js
module.exports = {
created: function () {
this.hello()
},
methods: {
hello: function () {
console.log('hello from mixin!')
}
}
}
// test.js
var myMixin = require('./mixin')
var Component = Vue.extend({
mixins: [myMixin]
})
var component = new Component() // -> "hello from mixin!"
// mixin.js
module.exports = {
methods: {
hello: function () {
console.log('hello from mixin!')
}
}
}
// test.js
var myMixin = require('./mixin')
var Component = Vue.extend({
mixins: [myMixin]
})
var component = new Component();
component.hello();
component.hello is not a function
Hi, why its closed? do you have solution?
Most helpful comment
Hi, why its closed? do you have solution?