| | |
| | | }, |
| | | // 上传成功回调 |
| | | handleUploadSuccess(res) { |
| | | if (res.code == 200) { |
| | | this.fileList.push({ name: res.data.fileName, url: res.data.url }); |
| | | this.$emit("input", this.listToString(this.fileList)); |
| | | this.loading.close(); |
| | | } else { |
| | | this.$message.error(res.msg); |
| | | this.loading.close(); |
| | | } |
| | | }, |
| | | // 上传前loading加载 |
| | | handleBeforeUpload(file) { |
| | |
| | | if (file.name.lastIndexOf(".") > -1) { |
| | | fileExtension = file.name.slice(file.name.lastIndexOf(".") + 1); |
| | | } |
| | | isImg = this.fileType.some(type => { |
| | | isImg = this.fileType.some((type) => { |
| | | if (file.type.indexOf(type) > -1) return true; |
| | | if (fileExtension && fileExtension.indexOf(type) > -1) return true; |
| | | return false; |
| | |
| | | this.$message.error(`上传文件数量不能超过 ${this.limit} 个!`); |
| | | }, |
| | | // 上传失败 |
| | | handleUploadError() { |
| | | handleUploadError(res) { |
| | | this.$message({ |
| | | type: "error", |
| | | message: "上传失败", |
| | |
| | | for (let i in list) { |
| | | strs += list[i].url + separator; |
| | | } |
| | | return strs != '' ? strs.substr(0, strs.length - 1) : ''; |
| | | } |
| | | } |
| | | return strs != "" ? strs.substr(0, strs.length - 1) : ""; |
| | | }, |
| | | }, |
| | | }; |
| | | </script> |
| | | <style scoped lang="scss"> |
| | |
| | | transition: all 0s; |
| | | } |
| | | |
| | | ::v-deep .el-list-enter, .el-list-leave-active { |
| | | ::v-deep .el-list-enter, |
| | | .el-list-leave-active { |
| | | opacity: 0; |
| | | transform: translateY(0); |
| | | } |