vue方法调用传参,es6模版字符串怎么转表达式?-灵析社区

笑面猫

vue方法调用传参,es6模版字符串怎么转表达式? this.uploadFile(file, 'databaseCsvFiles') uploadFile(file, target) { `this.${target}` = xxx // 报错 Invalid left-hand side in assignment expression }

阅读量:24

点赞量:0

问AI
怼怼事务所
改成这样 this.uploadFile(file, 'databaseCsvFiles') uploadFile(file, target) { this[target] = xxx }