通过接口获取数据后,返回的参数想要添加在提示信息后面,需要添加括号
if (res.code === '1') {
// 上传成功
this.$message.success(this.$t('dataManagement.successfulSubmis')+':'+ (res.data==null||''?'':res.data))
this.$emit('updateTable') //导入数据成功后,调用父组件的方法更新列表
this.visible = false
} else {
self.$message.error(this.$t('dataManagement.failureToSubmit')+':'+ (res.msg==null||''?'':res.msg))
}
}).catch( err => {
// 提交失败
self.$message.error(this.$t('dataManagement.failureToSubmit') +':'+ ( res.msg==null||''?'':res.msg))
})
} else {
this.$message.warning(this.$t('dataManagement.pleaseSelectTheFileFirst'))
}
如果不添加括号的话
前面的字符串自动忽略。