@fe-components/cpv-file

🔨 A Component for upload file.

Usage no npm install needed!

<script type="module">
  import feComponentsCpvFile from 'https://cdn.skypack.dev/@fe-components/cpv-file';
</script>

README

cpv-file

Build Status NPM Download NPM Version NPM License PRs Welcome Automated Release Notes by gren

文件上传通用组件,依赖于 iview 插件 👏

Table of Contents

Features

  • 支持表单校验

  • 支持单/多个文件上传

  • 支持限制文件格式

  • 支持限制文件大小

  • 支持限制文件个数

  • 支持多种文件格式上传

    • txt
    • zip
    • rar
    • ...

⬆ Back to Top

Install

yarn add @fe-components/cpv-file

⬆ Back to Top

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/

⬆ Back to Top

Links

⬆ Back to Top

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.

⬆ Back to Top

Contributors

Thanks goes to these wonderful people (emoji key):


yuwangi

💻 📖 ⚠️ 🌍🐛

ynwshy

💻 🐛

This project follows the all-contributors specification. Contributions of any kind welcome!

⬆ Back to Top

License

MIT

⬆ Back to Top