|
@@ -46,19 +46,19 @@
|
|
|
import { getToken } from "@/utils/auth";
|
|
|
|
|
|
export default {
|
|
|
- name: 'ImageUpload',
|
|
|
+ name: 'ImageUpload',
|
|
|
props: {
|
|
|
- ImageUpload: Function,
|
|
|
+ ImageUpload: Function,
|
|
|
value: [String, Object, Array],
|
|
|
// 图片数量限制
|
|
|
limit: {
|
|
|
type: Number,
|
|
|
- default: 5,
|
|
|
+ default: 1,
|
|
|
},
|
|
|
// 大小限制(MB)
|
|
|
fileSize: {
|
|
|
- type: Number,
|
|
|
- default: 5,
|
|
|
+ type: Number,
|
|
|
+ default: 10,
|
|
|
},
|
|
|
// 文件类型, 例如['png', 'jpg', 'jpeg']
|
|
|
fileType: {
|
|
@@ -115,30 +115,30 @@ export default {
|
|
|
},
|
|
|
|
|
|
methods: {
|
|
|
- clear: function(){
|
|
|
- alert('2')
|
|
|
+ clear: function(){
|
|
|
+ alert('2')
|
|
|
|
|
|
|
|
|
- },
|
|
|
+ },
|
|
|
// 删除图片
|
|
|
handleRemove(file, fileList) {
|
|
|
const findex = this.fileList.map(f => f.name).indexOf(file.name);
|
|
|
if(findex > -1) {
|
|
|
this.fileList.splice(findex, 1);
|
|
|
- this.$emit("input", this.listToString(this.fileList));
|
|
|
- // this.ImageUpload.setUrl("")
|
|
|
+ this.$emit("input", this.fileList);
|
|
|
+ // this.ImageUpload.setUrl("")
|
|
|
}
|
|
|
},
|
|
|
// 上传成功回调
|
|
|
handleUploadSuccess(res) {
|
|
|
- this.uploadList.push({ name: res.data.url, url: res.data.url });
|
|
|
+ this.uploadList.push({ name: res.data.url, url: res.data.webUrl });
|
|
|
if (this.uploadList.length === this.number) {
|
|
|
this.fileList = this.fileList.concat(this.uploadList);
|
|
|
this.uploadList = [];
|
|
|
this.number = 0;
|
|
|
console.log("213",this.fileList)
|
|
|
- // this.ImageUpload.setUrl(res.data.url)
|
|
|
- this.$emit("input", this.listToString(this.fileList));
|
|
|
+ // this.ImageUpload.setUrl(res.data.url)
|
|
|
+ this.$emit("input", this.fileList);
|
|
|
this.$modal.closeLoading();
|
|
|
}
|
|
|
},
|
|
@@ -202,17 +202,17 @@ export default {
|
|
|
<style scoped lang="scss">
|
|
|
// .el-upload--picture-card 控制加号部分
|
|
|
::v-deep.hide .el-upload--picture-card {
|
|
|
- display: none;
|
|
|
+ display: none;
|
|
|
}
|
|
|
// 去掉动画效果
|
|
|
::v-deep .el-list-enter-active,
|
|
|
::v-deep .el-list-leave-active {
|
|
|
- transition: all 0s;
|
|
|
+ transition: all 0s;
|
|
|
}
|
|
|
|
|
|
::v-deep .el-list-enter, .el-list-leave-active {
|
|
|
- opacity: 0;
|
|
|
- transform: translateY(0);
|
|
|
+ opacity: 0;
|
|
|
+ transform: translateY(0);
|
|
|
}
|
|
|
</style>
|
|
|
|