File tree Expand file tree Collapse file tree 4 files changed +150
-7
lines changed Expand file tree Collapse file tree 4 files changed +150
-7
lines changed Original file line number Diff line number Diff line change 9
9
<vue-core-image-upload
10
10
:class =" ['btn', 'btn-primary']"
11
11
:crop =" false"
12
- @imageuploaded = " imageUploded "
13
- :max-file-size = " 5242880 "
12
+ :data = " data "
13
+ @imageuploaded = " imageuploaded "
14
14
:multiple =" true"
15
15
:multiple-size =" 4"
16
16
url =" http://101.198.151.190/api/upload.php" >
17
17
</vue-core-image-upload >
18
18
</div >
19
+ <p >上传的过程中我们可以打开devtool查看请求,可以看到发送数据中带上了一个新的 text 字段,也就是文本框内容。</p >
20
+ <p ><img width =" 480" src =" http://img1.vued.vanthink.cn/vued6491e814a4b12bfcaecd628a6732beb0.png" /></p >
21
+ <h4 >Code Example</h4 >
22
+ <pre v-highlightjs ><code class =" javascript" >< ; template> ;
23
+ < ; div class="m-form"> ;
24
+ < ; input type="text" v-model="data.text" placeholder="输入一些内容吧" class="form-control text" /> ;
25
+ < ; vue-core-image-upload
26
+ :class="['btn', 'btn-primary']"
27
+ :crop="false"
28
+ :data="data"
29
+ @imageuploaded="imageuploaded"
30
+ :multiple="true"
31
+ :multiple-size="4"
32
+ url="http://101.198.151.190/api/upload.php" > ;
33
+ < ; /vue-core-image-upload> ;
34
+ < ; /div> ;
35
+ < ; /template> ;
36
+
37
+ < ; script> ;
38
+ import VueCoreImageUpload from '../../../../src/vue-core-image-upload.vue'
39
+ export default {
40
+ components: {
41
+ VueCoreImageUpload,
42
+ },
43
+
44
+ data() {
45
+ return {
46
+ data: {
47
+ text: ''
48
+ }
49
+ }
50
+ },
51
+
52
+ };
53
+ < ; /script> ;
54
+ </code ></pre >
55
+ <a href =" " >查看完整源码</a >
19
56
</div >
20
57
</template >
21
58
<style >
@@ -40,6 +77,12 @@ export default {
40
77
text: ' '
41
78
}
42
79
}
80
+ },
81
+
82
+ methods: {
83
+ imageuploaded (res ) {
84
+
85
+ }
43
86
}
44
87
45
88
};
Original file line number Diff line number Diff line change
1
+ <template >
2
+ <div class =" components" >
3
+ <h3 >Send Data to Server</h3 >
4
+ <p >Setting <code >data</code > attribute will send some data you bind to the server via ajax</p >
5
+ <h4 >Exmaple:</h4 >
6
+ <p >You could type some text here and its text will be sended to the server when you upload your image.</p >
7
+ <div class =" m-form" >
8
+ <input type =" text" v-model =" data.text" placeholder =" type some..." class =" form-control text" />
9
+ <vue-core-image-upload
10
+ :class =" ['btn', 'btn-primary']"
11
+ :crop =" false"
12
+ :data =" data"
13
+ @imageuploaded =" imageuploaded"
14
+ :multiple =" true"
15
+ :multiple-size =" 4"
16
+ url =" http://101.198.151.190/api/upload.php" >
17
+ </vue-core-image-upload >
18
+ </div >
19
+ <p >We could open chrome devtool to view http status when uploading image. Below is the result after uploading image successfully.</p >
20
+ <p ><img width =" 480" src =" http://img1.vued.vanthink.cn/vued6491e814a4b12bfcaecd628a6732beb0.png" /></p >
21
+ <h4 >Code Example</h4 >
22
+ <pre v-highlightjs ><code class =" javascript" >< ; template> ;
23
+ < ; div class="m-form"> ;
24
+ < ; input type="text" v-model="data.text" placeholder="输入一些内容吧" class="form-control text" /> ;
25
+ < ; vue-core-image-upload
26
+ :class="['btn', 'btn-primary']"
27
+ :crop="false"
28
+ :data="data"
29
+ @imageuploaded="imageuploaded"
30
+ :multiple="true"
31
+ :multiple-size="4"
32
+ url="http://101.198.151.190/api/upload.php" > ;
33
+ < ; /vue-core-image-upload> ;
34
+ < ; /div> ;
35
+ < ; /template> ;
36
+
37
+ < ; script> ;
38
+ import VueCoreImageUpload from '../../../../src/vue-core-image-upload.vue'
39
+ export default {
40
+ components: {
41
+ VueCoreImageUpload,
42
+ },
43
+
44
+ data() {
45
+ return {
46
+ data: {
47
+ text: ''
48
+ }
49
+ }
50
+ },
51
+
52
+ };
53
+ < ; /script> ;
54
+ </code ></pre >
55
+ <a href =" " >View code source</a >
56
+ </div >
57
+ </template >
58
+ <style >
59
+ .form-control {
60
+ display : block ;
61
+ margin : 20px 0 ;
62
+ padding : 5px 20px ;
63
+ }
64
+ </style >
65
+
66
+
67
+ <script >
68
+ import VueCoreImageUpload from ' ../../../../src/vue-core-image-upload.vue'
69
+ export default {
70
+ components: {
71
+ VueCoreImageUpload,
72
+ },
73
+
74
+ data () {
75
+ return {
76
+ data: {
77
+ text: ' '
78
+ }
79
+ }
80
+ },
81
+
82
+ methods: {
83
+ imageuploaded (res ) {
84
+
85
+ }
86
+ }
87
+ };
88
+
89
+ </script >
Original file line number Diff line number Diff line change @@ -82,14 +82,15 @@ aside{
82
82
color : #fff ;
83
83
padding : 10px ;
84
84
font-size : 15px ;
85
-
85
+
86
86
}
87
87
ul {
88
88
background-color : #e1e1e1 ;
89
89
padding-bottom : 20px ;
90
90
}
91
91
li {
92
92
margin-bottom : 5px ;
93
+ margin-top : 0 ;
93
94
}
94
95
a {
95
96
display : inline-block ;
@@ -108,10 +109,10 @@ aside{
108
109
max-width : 900px ;
109
110
min-height : 400px ;
110
111
padding : 100px 20px ;
111
-
112
+
112
113
.components {
113
114
text-align : left ;
114
-
115
+
115
116
.center {
116
117
text-align : center ;
117
118
}
@@ -141,8 +142,8 @@ aside{
141
142
.ft .lang-list a {
142
143
margin : 0 10px ;
143
144
color : #999 ;
144
-
145
+
145
146
& .active {
146
147
color : @emerald ;
147
148
}
148
- }
149
+ }
Original file line number Diff line number Diff line change @@ -10,7 +10,9 @@ import CnCropImage from '../components/doc/cn/CropImage.vue';
10
10
import CnMultipleFile from '../components/doc/cn/MultipleFile.vue' ;
11
11
import CnCompressImage from '../components/doc/cn/CompressImage.vue' ;
12
12
import CnPostData from '../components/doc/cn/PostData.vue' ;
13
+ import EnPostData from '../components/doc/en/PostData.vue' ;
13
14
import CnOthers from '../components/doc/cn/Others.vue' ;
15
+ import EnOthers from '../components/doc/en/Others.vue' ;
14
16
15
17
Vue . use ( Router )
16
18
@@ -62,9 +64,17 @@ export default new Router({
62
64
path : '/cn/post-data' ,
63
65
component : CnPostData
64
66
} ,
67
+ {
68
+ path : '/en/post-data' ,
69
+ component : EnPostData ,
70
+ } ,
65
71
{
66
72
path : '/cn/others' ,
67
73
component : CnOthers ,
74
+ } ,
75
+ {
76
+ path : '/en/others' ,
77
+ component : EnOthers ,
68
78
}
69
79
]
70
80
} )
You can’t perform that action at this time.
0 commit comments