Skip to content

Commit bc24562

Browse files
committed
v2.0.0-beta
1 parent 601c0c4 commit bc24562

13 files changed

+9758
-12031
lines changed

README.md

Lines changed: 87 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,9 @@
88
## Install
99

1010
``` bash
11-
npm install vue-upload-component --save
11+
npm install vue-upload-component@next --save
1212
```
13+
1314
### CommonJS
1415
```js
1516
var FileUpload = require('vue-upload-component');
@@ -73,93 +74,119 @@ npm run build
7374
```
7475

7576

76-
## $dispatch, methods
77-
addFileUpload
7877

79-
removeFileUpload
78+
# Setting
8079

81-
fileUploadProgress
8280

83-
beforeFileUpload
81+
## Props
82+
``` html
83+
<file-upload
84+
title="Add upload files"
8485

85-
afterFileUpload
86+
name="post file name"
8687

88+
drop="Boolean (true = $parent) or Element or Css Selector"
8789

90+
extensions="Array or String or Regular"
8891

92+
post-action="./post.method"
8993

90-
## Setting
94+
put-action="./put.method"
9195

92-
### Data
93-
``` js
94-
{
95-
files: [
96-
{
97-
id: 'String', // Read only
98-
name: 'filename String',
99-
size: 'filesize Number',
100-
progress: 'progress String', // Read only
101-
speed: "Speed Number", // Read only
102-
active: 'active Boolean',
103-
error: 'error String',
104-
errno: 'errno String',
105-
success: 'success Boolean', // Read only
106-
data: 'Response data Object or String', // Read only
107-
request: {
108-
headers: {
109-
"X-Csrf-Token": "xxxx",
110-
},
111-
data: {
112-
"_csrf_token": "xxxxxx",
113-
},
114-
},
115-
}
116-
],
96+
accept="accept"
11797

98+
multiple="true or false"
11899

119-
// Global
120-
request: {
121-
headers: {
122-
"X-Csrf-Token": "xxxx",
123-
},
124-
data: {
125-
"_csrf_token": "xxxxxx",
126-
},
127-
},
100+
size="max Size"
128101

102+
timeout="3600000"
129103

130-
active: false,
104+
events="Object"
131105

132-
uploaded: true, // Read only
106+
headers="Request headers object"
133107

134-
dropActive: false, // Read only
135-
}
108+
data="Request data object"
109+
110+
files="Upload files"
111+
>
112+
</file-upload>
136113
```
137114

138115

139-
### Props
140-
``` html
141-
<file-upload :title="Add upload files" :name="file" :drop="Boolean (true = $parent) or Element or Css Selector" :extensions="Array or String or Regular" :post-action="./post.method" :put-action="./put.method" :accept="accept" :multiple="true" :size="size" :timeout="3600000"></file-upload>
142-
```
143116

117+
118+
### Props events
119+
``` js
120+
events: {
121+
add(file, component) {
122+
console.log('add');
123+
if (this.auto) {
124+
component.active = true;
125+
}
126+
file.headers['X-Filename'] = encodeURIComponent(file.name)
127+
file.data.finename = file.name
128+
129+
// file.putAction = 'xxx'
130+
// file.postAction = 'xxx'
131+
},
132+
progress(file, component) {
133+
console.log('progress ' + file.progress);
134+
},
135+
after(file, component) {
136+
console.log('after');
137+
},
138+
before(file, component) {
139+
console.log('before');
140+
}
141+
}
144142
```
145-
title="Add upload files"
146143

147-
name="post file name"
148144

149-
drop="Boolean (true = $parent) or Element or Css Selector"
150145

151-
extensions="Array or String or Regular" :post-action="./post.method"
146+
### Props files
147+
``` js
148+
[
149+
{
150+
id: 'String', // Read only
151+
name: 'filename String',
152+
size: 'filesize Number', // -1 = html4
153+
progress: 'progress String', // Read only
154+
speed: "Speed Number", // Read only
155+
active: 'active Boolean', // set active = fasle abort upload
156+
error: 'error String', // Read only
157+
success: 'success Boolean', // Read only
158+
data: 'Response data Object or String', // Read only
159+
putAction: 'String uri',
160+
postAction: 'String uri',
161+
timeout: "Number",
162+
headers: {
163+
"X-Csrf-Token": "xxxx",
164+
},
165+
data: {
166+
"_csrf_token": "xxxxxx",
167+
},
168+
169+
xhr: "False or XMLHttpRequest object", // html5
170+
iframe: "False or Element object", // html4
171+
file: "undefined or File object" // html5
172+
el: "undefined or Input object"
173+
}
174+
]
175+
```
152176

153-
post-action="./post.method"
154177

155-
put-action="./put.method"
156178

157-
accept="accept"
158179

159-
multiple="true or false"
160180

161-
size="max Size"
181+
## data
182+
``` js
183+
{
184+
mode: 'html5', // html5 or html4
162185

163-
timeout="3600000"
186+
active: false, // set active = fasle abort upload
164187

188+
uploaded: true, // Read only
189+
190+
dropActive: false, // Read only
191+
}
165192
```

0 commit comments

Comments
 (0)