1、动态改变action地址 :action="getURL(scope.row.name)"
2、后端上传要token :headers="myHeaders" data中 myHeaders: { token: this.$store.state.user.token }
3、上传一定数量后隐藏加号 :class="{hideUploadPlus: tableData[scope.row.id - 1]['images'].length > 4}" 去掉scoped .hideUploadPlus .el-upload--picture-card { display: none; }
4、删除时自定义传参 :on-remove="(file, fileList) => {handleRemove(file, fileList, scope.row);}"
5、el-upload多文件时删除加了确认遇到的问题
beforeRemove(file, fileList) {
return new Promise((resolve, reject) => {
this.$confirm(`您确定要移除吗?`)
.then(() => {
this.fileList.forEach((item, index) => {
if (file.uid == item.uid) {
this.$nextTick(() => {
this.fileList.splice(index, 1)
})
}
})
resolve()
})
.catch(() => reject())
})
},