vue-img-inputer
v2.1.6
Published
A graceful image type inputer / uploader
Downloads
443
Maintainers
Readme
Intro
<input type="file" />
like, only support single image- auto-upload support
- drop-select / preview / use as
<img />
as well - optional skins
Screenshots
Install and Usage
npm install vue-img-inputer
import ImgInputer from 'vue-img-inputer'
import 'vue-img-inputer/dist/index.css'
Vue.component('ImgInputer', ImgInputer)
<img-inputer v-model="file" theme="light" size="large"/>
API
auto-upload
: Boolean
set to enable auto-uploadaction
: String
request URLupload-key
: String
default:file
key name in form-dataextra-data
: Object
extra data been appended in request's form-dataheaders
: Object
additional headers of requestwith-cookie
: Boolean
whether cookies will been senton-start
: Function
params: func ( file )
hook function when upload starton-progress
: Function
params: func ( event, file )
hook function when uploading, get progress byevent.percent
on-success
: Function
params: func ( res, file )
hook function when upload success,res
is response from serveron-error
: Function
params: func ( err, file )
hook function when upload failed
accept
: String
default:image/*,video/*;
suggest to set a specific value likeimage/jpg,image/gif;
for wildcard will lead to a serious delayplaceholder
: String
default:Drop file here or click
id
: String
default: random string in 4 length
id of input tagreadonly
: Booleancapture
: Boolean
default:false
whether use camera directly in mobilemax-size
: Number
default: 5120
max-size of image (KB)name
: Boolean
name of input tagany input's attribute
any input's original attributes set on component will be inherited by inner input tag
img-src
: String
image resource let component behavior like<img />
theme
: String
default:material
two themes optional (light / material)size
: String small / normal / largeicon
: String
clip / img / img2ali-icon
: String
if you use iconfont.cn, set unicode of any icon to customno-mask
: Boolean
remove mask when hoverno-hover-effect
: Boolean
remove all hover effect (include text) when hoverbottom-text
: String
default:Drop file here or click to change
text in the bottom when hoverno-multiple-text
: String
default:Not support multiple files
visible only the state isreadonly
, cover bottom-textexceed-size-text
: String
default:The size of file should less than: ${maxSize}
visible only the state isreadonly
, cover bottom-textno-action-text
: String
default:Action hasn't set up yet
visible only the state isreadonly
, cover bottom-textreadonly-tip-text
: String
default:Readonly
visible only the state isreadonly
, cover bottom-text
onChange
: Function
params: func ( file, fileName )
hook function when file selectedonExceed
: Function
params: func ( file )
hook function when file exceed max-size
reset
reset componet but will not clearimg-src