@fe-components/cpv-file
v1.2.0
Published
🔨 A Component for upload file.
Downloads
6
Readme
cpv-file
文件上传通用组件,依赖于 iview
插件 👏
Table of Contents
Features
支持表单校验
支持单/多个文件上传
支持限制文件格式
支持限制文件大小
支持限制文件个数
支持多种文件格式上传
- [x] txt
- [x] zip
- [x] rar
- [x] ...
Install
yarn add @fe-components/cpv-file
Usage
<cpv-file v-bind="childProp" />
<script>
export default {
data() {
return {
/*
* @childProp
*/
childProp: {
name: '附件上传',
prop: 'file',
required: true,
maxSize: 1024 * 10, //10M
multiple: false,
fileNum: 1,
token: '126dcc1f-5bb6-45b4-9c2a-1e74b28ecbe6', //请求携带的 token
baseUrl: 'oscs-api' //转发地址
},
formData: {},
modalType: 'readonly'
}
},
provide() {
return {formData: this.formData, modalType: this.modalType}
},
methods: {
submit() {
this.$refs.formData.validate(valid => {
if (valid) {
}
})
}
}
}
</script>
//具体用法参考 docs/
Links
Contributing
For those who are interested in contributing to this project, such as:
- report a bug
- request new feature
- fix a bug
- implement a new feature
Please refer to our contributing guide.
Contributors
Thanks goes to these wonderful people (emoji key):
This project follows the all-contributors specification. Contributions of any kind welcome!