I am trying to call the mixin function within the template. Vue documentation says mixin and the component are merged but i can't call the function.
getImage is not a function
Mixin
export default {
data() {
return {
l: 2,
output: 'webp'
}
},
methods: {
getImage() {
return 'www.example.url'
}
}
}
Component
<template>
<v-img :src="getImage()" />
</template>
<script>
import imageMixin from '~/mixins/image'
export default {
name: 'New',
mixin: { imageMixin }
}
</script>
<style scoped></style>
Change mixin: { imageMixin }
to mixins: [imageMixin]
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