Vue计算属性的使用
不传参
computed: {
// 仅读取
aDouble: function () {
return this.a * 2
},
// 读取和设置
aPlus: {
get: function () {
return this.a + 1
},
set: function (v) {
this.a = v - 1
}
}
}
在插槽中传参
<img style="width: 100px" :src="_downloadUrl(scope.row)" class="image">
computed: {
_downloadUrl(){
return function(row){
return 'process.env.VUE_APP_UPLOAD_URL' + row.savePath + '/' + row.saveName
}
}
}