1.0.1-0 • Published 7 years ago

app-element-upload v1.0.1-0

Weekly downloads
2
License
MIT
Repository
github
Last release
7 years ago

element-upload

A element-upload component for Vue.js.

Demo

http://element-component.github.io/element-upload

Installation

npm i element-upload -D

Usage

import Vue from 'vue'
import ElUpload from 'element-upload'
import 'element-theme-default/dist/upload.css'

Vue.use(ElUpload)

or

import Vue from 'vue'
import ElUpload from 'element-upload'

Vue.component('el-upload', ElUpload)

Attribute

参数说明类型可选值默认值
action必选参数, 上传的地址string
headers可选参数, 设置上传的请求头部object
multiple可选参数, 是否支持多选文件boolean
data可选参数, 上传时附带的额外参数object
name可选参数, 上传的文件字段名stringfile
with-credentials支持发送 cookie 凭证信息booleanfalse
show-upload-list是否显示已上传文件列表booleantrue
type上传控件类型stringselect,dragselect
accept可选参数, 接受上传的文件类型(thumbnail-mode 模式下此参数无效)string
on-preview可选参数, 点击已上传的文件链接时的钩子, 可以通过 file.response 拿到服务端返回数据function(file)
on-remove可选参数, 文件列表移除文件时的钩子function(file, fileList)
on-success可选参数, 文件上传成功时的钩子function(response, file, fileList)
on-error可选参数, 文件上传失败时的钩子function(err, response, file)
before-upload可选参数, 上传文件之前的钩子,参数为上传的文件,若返回 false 或者 Promise 则停止上传。function(file)
thumbnail-mode是否设置为图片模式,该模式下会显示图片缩略图booleanfalse
default-file-list默认已上传的文件列表, 例如: {name: 'food.jpeg', url: 'https://fuss10.elemecdn.com/3/63/4e7f3a15429bfda99bce42a18cdd1jpeg.jpeg?imageMogr2/thumbnail/360x360/format/webp/quality/100'}array[]

Methods

方法名说明参数
clearFiles清空已上传的文件列表

Development

make dev

## test
make test

## build
make build

License

MIT

1.0.1-0

7 years ago