Git Product home page Git Product logo

yxbook / dzmantdvupload Goto Github PK

View Code? Open in Web Editor NEW

This project forked from dengzemiao/dzmantdvupload

0.0 1.0 0.0 30.03 MB

基于 antdv 的上传组件 a-upload 进行二次封装,扩展了重复文件效验,文件大小限制,文件数量限制,视频或图片大小宽高比例限制,检测错误控制,错误自定义以及回调处理,文件检测模式等常用功能

JavaScript 1.80% HTML 1.59% Vue 96.61%

dzmantdvupload's Introduction

DZMAntdvUpload

基于 antdv 的上传组件 a-upload、a-upload-dragger 进行二次封装,扩展了重复文件效验,文件大小限制,文件数量限制,视频或图片大小宽高比例限制,检测错误控制,错误自定义以及回调处理,文件检测模式等常用功能

使用

<template>
  <div class="home-view">

    <!-- 上传组件 -->
    <upload :customRequestPro="customRequestPro" :beforeUploadPro="beforeUploadPro"></upload>

    <!-- 启用拖拽上传组件 -->
    <upload :isDragger="true" :customRequestPro="customRequestPro" :beforeUploadPro="beforeUploadPro"></upload>

    <!-- 上传组件 -->
    <!-- <upload :customRequestPro="customRequestPro">
      <span slot="up-title">三水上传</span>
    </upload> -->

    <!-- 上传组件 - 自定义 -->
    <!-- <upload :customRequestPro="customRequestPro" :disabled="true"> -->
      <!-- 自定义上传UI -->
      <!-- <template slot="up-slot" slot-scope="props"> -->
        <!-- 使用内部禁用属性 -->
        <!-- <a-button :disabled="props.disabled">三水上传Pro</a-button> -->
        <!-- 不使用内部禁用属性 -->
        <!-- <a-button>三水上传Pro</a-button>
      </template>
    </upload> -->
    
  </div>
</template>

<script>
// 导入组件
import Upload from '@/components/Upload'
export default {
  components: {
    Upload
  },
  methods: {
    // 准备上传
    beforeUploadPro () {
      // return true
      return new Promise((resolve, reject) => {
        resolve()
      })
    },
    customRequestPro (data, fileJson, result) {
      // 上传完成
      setTimeout(() => {
        result(true)
      }, 2000)
    }
  }
}
</script>

<style scoped>
.home-view {
  display: flex;
  align-items: center;
  justify-content: center;
}
</style>

dzmantdvupload's People

Contributors

dengzemiao avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.