Skip to content

Commit 1790dab

Browse files
committed
docs: update upload demo #753
1 parent a5bb191 commit 1790dab

16 files changed

+92
-82
lines changed

components/upload/__tests__/uploadlist.test.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ describe('Upload List', () => {
9797
it('should be uploading when upload a file', done => {
9898
const props = {
9999
propsData: {
100-
action: 'http://jsonplaceholder.typicode.com/posts/',
100+
action: 'https://www.mocky.io/v2/5cc8019d300000980a055e76',
101101
customRequest: successRequest,
102102
},
103103
listeners: {
@@ -133,7 +133,7 @@ describe('Upload List', () => {
133133
it('handle error', done => {
134134
const props = {
135135
propsData: {
136-
action: 'http://jsonplaceholder.typicode.com/posts/',
136+
action: 'https://www.mocky.io/v2/5cc8019d300000980a055e76',
137137
customRequest: errorRequest,
138138
},
139139
listeners: {
@@ -166,7 +166,7 @@ describe('Upload List', () => {
166166
const handleChange = jest.fn();
167167
const props = {
168168
propsData: {
169-
action: 'http://jsonplaceholder.typicode.com/posts/',
169+
action: 'https://www.mocky.io/v2/5cc8019d300000980a055e76',
170170
listType: 'picture',
171171
defaultFileList: fileList,
172172
beforeUpload: () => false,

components/upload/demo/avatar.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ The return value of function `beforeUpload` can be a Promise to check asynchrono
1717
listType="picture-card"
1818
class="avatar-uploader"
1919
:showUploadList="false"
20-
action="//jsonplaceholder.typicode.com/posts/"
20+
action="https://www.mocky.io/v2/5cc8019d300000980a055e76"
2121
:beforeUpload="beforeUpload"
2222
@change="handleChange"
2323
>

components/upload/demo/basic.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ Classic mode. File selection dialog pops up when upload button is clicked.
1010

1111
```html
1212
<template>
13-
<a-upload name="file" :multiple="true" action="//jsonplaceholder.typicode.com/posts/" :headers="headers" @change="handleChange">
13+
<a-upload name="file" :multiple="true" action="https://www.mocky.io/v2/5cc8019d300000980a055e76" :headers="headers" @change="handleChange">
1414
<a-button>
1515
<a-icon type="upload" /> Click to Upload
1616
</a-button>

components/upload/demo/defaultFileList.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ Use `defaultFileList` for uploaded files when page init.
1010

1111
```html
1212
<template>
13-
<a-upload action="//jsonplaceholder.typicode.com/posts/" :defaultFileList="defaultFileList">
13+
<a-upload action="https://www.mocky.io/v2/5cc8019d300000980a055e76" :defaultFileList="defaultFileList">
1414
<a-button>
1515
<a-icon type="upload" /> Upload
1616
</a-button>

components/upload/demo/directory.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ You can select and upload a whole directory.
1010

1111
```html
1212
<template>
13-
<a-upload action="//jsonplaceholder.typicode.com/posts/" directory>
13+
<a-upload action="https://www.mocky.io/v2/5cc8019d300000980a055e76" directory>
1414
<a-button>
1515
<a-icon type="upload" /> Upload Directory
1616
</a-button>

components/upload/demo/drag.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ Classic mode. File selection dialog pops up when upload button is clicked.
1111

1212
```html
1313
<template>
14-
<a-upload-dragger name="file" :multiple="true" action="//jsonplaceholder.typicode.com/posts/" @change="handleChange">
14+
<a-upload-dragger name="file" :multiple="true" action="https://www.mocky.io/v2/5cc8019d300000980a055e76" @change="handleChange">
1515
<p class="ant-upload-drag-icon">
1616
<a-icon type="inbox" />
1717
</p>

components/upload/demo/fileList.md

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ You can gain full control over filelist by configuring `fileList`. You can accom
1616

1717
```html
1818
<template>
19-
<a-upload action="//jsonplaceholder.typicode.com/posts/" :multiple="true" :fileList="fileList" @change="handleChange">
19+
<a-upload action="https://www.mocky.io/v2/5cc8019d300000980a055e76" :multiple="true" :fileList="fileList" @change="handleChange">
2020
<a-button>
2121
<a-icon type="upload" /> Upload
2222
</a-button>
@@ -36,7 +36,7 @@ export default {
3636
},
3737
methods: {
3838
handleChange(info) {
39-
let fileList = info.fileList;
39+
let fileList = [...info.fileList];
4040
4141
// 1. Limit the number of uploaded files
4242
// Only to show two recent uploaded files, and old ones will be replaced by the new
@@ -51,14 +51,6 @@ export default {
5151
return file;
5252
});
5353
54-
// 3. filter successfully uploaded files according to response from server
55-
fileList = fileList.filter((file) => {
56-
if (file.response) {
57-
return file.response.status === 'success';
58-
}
59-
return false;
60-
});
61-
6254
this.fileList = fileList
6355
},
6456
},

components/upload/demo/picture-card.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ After users upload picture, the thumbnail will be shown in list. The upload butt
1212
<template>
1313
<div class="clearfix">
1414
<a-upload
15-
action="//jsonplaceholder.typicode.com/posts/"
15+
action="https://www.mocky.io/v2/5cc8019d300000980a055e76"
1616
listType="picture-card"
1717
:fileList="fileList"
1818
@preview="handlePreview"

components/upload/demo/picture-style.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ If uploaded file is a picture, the thumbnail can be shown. `IE8/9` do not suppor
1212
<template>
1313
<div>
1414
<a-upload
15-
action="//jsonplaceholder.typicode.com/posts/"
15+
action="https://www.mocky.io/v2/5cc8019d300000980a055e76"
1616
listType="picture"
1717
:defaultFileList="fileList"
1818
>
@@ -23,7 +23,7 @@ If uploaded file is a picture, the thumbnail can be shown. `IE8/9` do not suppor
2323
<br />
2424
<br />
2525
<a-upload
26-
action="//jsonplaceholder.typicode.com/posts/"
26+
action="https://www.mocky.io/v2/5cc8019d300000980a055e76"
2727
listType="picture"
2828
:defaultFileList="fileList"
2929
class="upload-list-inline"

components/upload/demo/upload-manually.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ export default {
6161
6262
// You can use any AJAX library you like
6363
reqwest({
64-
url: '//jsonplaceholder.typicode.com/posts/',
64+
url: 'https://www.mocky.io/v2/5cc8019d300000980a055e76',
6565
method: 'post',
6666
processData: false,
6767
data: formData,

0 commit comments

Comments
 (0)