Skip to content

Commit 904d092

Browse files
committed
add english post data doc
1 parent dd32749 commit 904d092

File tree

4 files changed

+150
-7
lines changed

4 files changed

+150
-7
lines changed

site/client/components/doc/cn/PostData.vue

Lines changed: 45 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,50 @@
99
<vue-core-image-upload
1010
:class="['btn', 'btn-primary']"
1111
:crop="false"
12-
@imageuploaded="imageUploded"
13-
:max-file-size="5242880"
12+
:data="data"
13+
@imageuploaded="imageuploaded"
1414
:multiple="true"
1515
:multiple-size="4"
1616
url="http://101.198.151.190/api/upload.php" >
1717
</vue-core-image-upload>
1818
</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">&lt;template&gt;
23+
&lt;div class="m-form"&gt;
24+
&lt;input type="text" v-model="data.text" placeholder="输入一些内容吧" class="form-control text" /&gt;
25+
&lt;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" &gt;
33+
&lt;/vue-core-image-upload&gt;
34+
&lt;/div&gt;
35+
&lt;/template&gt;
36+
37+
&lt;script&gt;
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+
&lt;/script&gt;
54+
</code></pre>
55+
<a href="">查看完整源码</a>
1956
</div>
2057
</template>
2158
<style>
@@ -40,6 +77,12 @@ export default {
4077
text: ''
4178
}
4279
}
80+
},
81+
82+
methods: {
83+
imageuploaded(res) {
84+
85+
}
4386
}
4487
4588
};
Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
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">&lt;template&gt;
23+
&lt;div class="m-form"&gt;
24+
&lt;input type="text" v-model="data.text" placeholder="输入一些内容吧" class="form-control text" /&gt;
25+
&lt;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" &gt;
33+
&lt;/vue-core-image-upload&gt;
34+
&lt;/div&gt;
35+
&lt;/template&gt;
36+
37+
&lt;script&gt;
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+
&lt;/script&gt;
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>

site/client/less/modules/m-layout.less

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -82,14 +82,15 @@ aside{
8282
color: #fff;
8383
padding: 10px;
8484
font-size: 15px;
85-
85+
8686
}
8787
ul{
8888
background-color: #e1e1e1;
8989
padding-bottom: 20px;
9090
}
9191
li{
9292
margin-bottom: 5px;
93+
margin-top: 0;
9394
}
9495
a{
9596
display: inline-block;
@@ -108,10 +109,10 @@ aside{
108109
max-width: 900px;
109110
min-height: 400px;
110111
padding: 100px 20px;
111-
112+
112113
.components {
113114
text-align: left;
114-
115+
115116
.center{
116117
text-align: center;
117118
}
@@ -141,8 +142,8 @@ aside{
141142
.ft .lang-list a {
142143
margin: 0 10px;
143144
color: #999;
144-
145+
145146
&.active {
146147
color: @emerald;
147148
}
148-
}
149+
}

site/client/router/index.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,9 @@ import CnCropImage from '../components/doc/cn/CropImage.vue';
1010
import CnMultipleFile from '../components/doc/cn/MultipleFile.vue';
1111
import CnCompressImage from '../components/doc/cn/CompressImage.vue';
1212
import CnPostData from '../components/doc/cn/PostData.vue';
13+
import EnPostData from '../components/doc/en/PostData.vue';
1314
import CnOthers from '../components/doc/cn/Others.vue';
15+
import EnOthers from '../components/doc/en/Others.vue';
1416

1517
Vue.use(Router)
1618

@@ -62,9 +64,17 @@ export default new Router({
6264
path: '/cn/post-data',
6365
component: CnPostData
6466
},
67+
{
68+
path: '/en/post-data',
69+
component: EnPostData,
70+
},
6571
{
6672
path: '/cn/others',
6773
component: CnOthers,
74+
},
75+
{
76+
path: '/en/others',
77+
component: EnOthers,
6878
}
6979
]
7080
})

0 commit comments

Comments
 (0)