I want to concatenate a fixed directory path, defined in data, with a file name defined in v-for
. When I try to do so with a computed property, I get:
"TypeError: _vm.filePath is not a function".
data: function(){
return{
imageDir: '../assets/images/tiles/'
}
},
computed:{
filePath: function(fileName){
let path = this.imageDir + fileName
return path
}
}
<image :src="filePath(tile.image)" />
When I move filePath
to the methods, it works. However, it was my impression that simple transforms like these are exactly what computed properties are for.