张恒

假接口

...@@ -15,10 +15,10 @@ ...@@ -15,10 +15,10 @@
15 :show-file-list="true" 15 :show-file-list="true"
16 :on-remove="handleRemove" 16 :on-remove="handleRemove"
17 :on-success="handleSuccess" 17 :on-success="handleSuccess"
18 - :before-upload="beforeUpload" 18 + :on-error="handleError"
19 :data="picPostData" 19 :data="picPostData"
20 class="editor-slide-upload" 20 class="editor-slide-upload"
21 - action="https://up-z2.qiniup.com/" 21 + action="https://jsonplaceholder.typicode.com/post/"
22 list-type="picture-card" 22 list-type="picture-card"
23 :limit="5" 23 :limit="5"
24 > 24 >
...@@ -92,42 +92,8 @@ export default { ...@@ -92,42 +92,8 @@ export default {
92 } 92 }
93 } 93 }
94 }, 94 },
95 - beforeUpload(file) { 95 + handleError(err){
96 - // const _self = this; 96 + this.alert(err)
97 - // const _URL = window.URL || window.webkitURL;
98 - // const fileName = file.uid;
99 - // this.listObj[fileName] = {};
100 - // return new Promise((resolve, reject) => {
101 - // let Sync = async () => {
102 - // try {
103 - // let picKey = await checkPic(file, this.fileList.length, 1);
104 - // if (picKey) {
105 - // let token = await this.getRequest(
106 - // "/qiniu/serveGetQiniuUpToken?key=" + picKey
107 - // );
108 - // console.log("picKey---", picKey, token);
109 - // this.picPostData = token;
110 - // const img = new Image();
111 - // img.src = _URL.createObjectURL(file);
112 - // img.onload = function() {
113 - // _self.listObj[fileName] = {
114 - // hasSuccess: false,
115 - // uid: file.uid,
116 - // width: this.width,
117 - // height: this.height
118 - // };
119 - // };
120 - // resolve(true);
121 - // } else {
122 - // reject(false);
123 - // this.listObj = {};
124 - // }
125 - // } catch (error) {
126 - // reject(false);
127 - // }
128 - // };
129 - // Sync();
130 - // });
131 } 97 }
132 } 98 }
133 }; 99 };
......