File tree Expand file tree Collapse file tree 2 files changed +23
-11
lines changed Expand file tree Collapse file tree 2 files changed +23
-11
lines changed Original file line number Diff line number Diff line change 7
7
<p >你可以使用<code >multiple-size</code >来限制图片的数量,你可以限制上传文件的数量。</p >
8
8
<h4 >演示</h4 >
9
9
<div class =" center" >
10
- <vue-core-image-upload
11
- :class =" ['btn', 'btn-primary']"
12
- :crop =" false"
13
- @imageuploaded =" imageUploded"
10
+ <vue-core-image-upload
11
+ :class =" ['btn', 'btn-primary']"
12
+ :crop =" false"
13
+ @imageuploaded =" imageUploded"
14
14
:max-file-size =" 5242880"
15
15
:multiple =" true"
16
16
:multiple-size =" 4"
17
- url =" http://101.198.151.190/api/upload .php" >
17
+ url =" http://101.198.151.190/api/upload2 .php" >
18
18
</vue-core-image-upload >
19
19
</div >
20
20
<table class =" m-table bordered" >
31
31
</tr >
32
32
</tbody >
33
33
</table >
34
+ <p >点击上传按钮,可以选择多张图片,然后在表格中可以看到上传的图片名称和图片大小。</p >
35
+ <h4 >Code Example</h4 >
36
+ <pre v-highlightjs ><code class =" javascript" >< ; vue-core-image-upload
37
+ :class="['btn', 'btn-primary']"
38
+ :crop="false"
39
+ @imageuploaded="imageUploded"
40
+ :max-file-size="5242880"
41
+ :multiple="true"
42
+ :multiple-size="4"
43
+ url="http://101.198.151.190/api/upload2.php" > ;
44
+ < ; /vue-core-image-upload> ; </code ></pre >
45
+ <a href =" " >查看完整源码</a >
34
46
</div >
35
47
</template >
36
48
37
49
<script >
38
- import VueCoreImageUpload from ' ../../../../src/vue-core-image-upload.vue'
50
+ import VueCoreImageUpload from ' ../../../../src/vue-core-image-upload.vue'
39
51
export default {
40
52
components: {
41
53
VueCoreImageUpload,
@@ -45,15 +57,15 @@ export default {
45
57
fileList: [],
46
58
}
47
59
},
48
-
60
+
49
61
methods: {
50
62
imageUploded (res ) {
51
63
if (res .errcode == 0 ) {
52
- this .fileList = res .data . fileList ;
64
+ this .fileList = res .data ;
53
65
}
54
66
}
55
67
}
56
-
68
+
57
69
};
58
70
59
- </script >
71
+ </script >
Original file line number Diff line number Diff line change 207
207
} else {
208
208
data = new FormData ();
209
209
for (let i= 0 ;i< this .files .length ;i++ ) {
210
- data .append (this .inputOfFile , this .files [i]);
210
+ data .append (this .name , this .files [i]);
211
211
}
212
212
console .log (data);
213
213
if (typeof this .data === ' object' ) {
You can’t perform that action at this time.
0 commit comments