## 安装
### npm 方式安装
``` bash
npm install vue-upload-component --save
```
``` js
const VueUploadComponent = require('vue-upload-component')
Vue.component('file-upload', VueUploadComponent)
```
### html 方式安装
``` html
```
## 使用
### 例子
https://lian-yue.github.io/vue-upload-component/
### 例子源代码
https://github.com/lian-yue/vue-upload-component/tree/2.0/example
### html
```html
Vue-upload-component Test
- {{file.name}} - Error: {{file.error}}, Success: {{file.success}}
Upload file
```
### SSR (服务器同构)
```js
import FileUpload from 'vue-upload-component/src'
```
### webpack.config.js
```js
const nodeExternals = require('webpack-node-externals');
{
//.....
externals: [
nodeExternals({whitelist:[/^vue-upload-component/]})
]
//.....
}
```
***
## Props 参数
### inputId
* **类型:** `String`
* **默认值:** `this.name`
* **描述:**
input标签的 `id` 属性
* **用法:**
```html
```
### name
* **类型:** `String`
* **默认值:** `file`
* **描述:**
input标签的 `name` 属性
* **用法:**
```html
```
### post-action
* **类型:** `String`
* **默认值:** `undefined`
* **描述:**
`POST` 请求的上传URL
* **用法:**
```html
```
### put-action
* **类型:** `String`
* **默认值:** `undefined`
* **描述:**
`PUT` 请求的上传URL
`put-action` 不为空请优先 `PUT` 请求
需要`HTML5`支持
* **用法:**
```html
```
`PUT` 请求的上传地址
地址不为空请优先 `PUT` 请求
### headers
* **类型:** `Object`
* **默认值:** `{}`
* **描述:**
自定义 `HTTP Header`
需要`HTML5`支持
* **用法:**
```html
```
### data
* **类型:** `Object`
* **默认值:** `{}`
* **描述:**
`POST 请求`: 附加请求的 body
`PUT 请求`: 附加请求的 query
* **用法:**
```html
```
### value, v-model
* **类型:** `Array