waynecz/vue-img-inputer
Tentang
🏞 Inputer/pengunggah gambar yang elegan
Desain dan mediaPertumbuhan bintang terukur
- dalam 24 jam
- -1
- dalam 7 hari
- -1
- dalam 15 hari
- -1
- dalam 1 bulan
- Mengumpulkan riwayat
Perubahan bersih pada periode yang tumpang tindih, bukan total harian. Pengukuran yang belum tersedia dibiarkan kosong. Bintang menunjukkan perhatian, bukan kualitas.
README.md
Asli
点击查看中文文档 | Have a glance at Demo
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 related
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.percenton-success: Function
params: func ( res, file )
hook function when upload success,resis response from serveron-error: Function
params: func ( err, file )
hook function when upload failed
Input tag related
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 clickid: 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
UI related
img-src: String
image resource let component behavior like<img />theme: String
default:materialtwo 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
Events
onChange: Function
params: func ( file, fileName )
hook function when file selectedonExceed: Function
params: func ( file )
hook function when file exceed max-size
Methods
reset
reset componet but will not clearimg-src
Jelajahi proyek terkait
Memuat…