I am trying to call the mixin function within the template.(我正在尝试在模板中调用mixin函数。)
Vue documentation says mixin and the component are merged but i can't call the function.(Vue文档说mixin和组件已合并,但我不能调用该函数。)
getImage is not a function(getImage不是一个函数)
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>
ask by F4ll0ut translate from so
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…