Hello I have a component:
<template>
<upload-btn
color="black"
title="Carica foto"
:fileChangedCallback="fileChange" />
</template>
<script>
import fileUploadMixin from './../mixins/fileUploadMixin';
export default {
name: 'compoment',
mixins: [fileUploadMixin],
components:{
'upload-btn': UploadButton
},
data(){..},
methods: {
fileChange(file){
this.fileChanged(file);
}
}
</script>
And then my Mixin:
export default {
data () {
},
methods: {
fileChanged(file){
if(file){
this.itemImage = file;
this.previewImage = URL.createObjectURL(file);
}
}
}
}
The problem is it return this error like the mixins not is included, but actually is imported.
vue.runtime.esm.js?2b0e:1878 TypeError: this.fileChanged is not a function
I have tried also change my mixin with:
methods: {
fileChanged: function(file){}
}
but it doesn't work.
What i'm wrong?
For others developers.
I'have solved.
The problem was that my Mixins file extension was wrong.
I have put Mixin.vue instead of Mixin.js, thank you all for answers.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With