All Projects → eJayYoung → Vux Uploader Component

eJayYoung / Vux Uploader Component

Licence: mit
a mobile vue component implementation for weui uploader

Projects that are alternatives of or similar to Vux Uploader Component

Html5 Uploader
A pure HTML5 file uploader
Stars: ✭ 9 (-89.66%)
Mutual labels:  uploader
Laravel Simple Uploader
Simple file uploader for Laravel 5.
Stars: ✭ 59 (-32.18%)
Mutual labels:  uploader
Uploadcare Php
PHP API client that handles uploads and further operations with files by wrapping Uploadcare Upload and REST APIs.
Stars: ✭ 77 (-11.49%)
Mutual labels:  uploader
Weui Extension
WeUI 和 WePayUI 的整合
Stars: ✭ 45 (-48.28%)
Mutual labels:  weui
Droply Js
Droply JS, a new responsive and cross browser chunk uploader with DragDrop and File Preview capabilities (HTML5/CSS3)
Stars: ✭ 50 (-42.53%)
Mutual labels:  uploader
Newsup
Fully feature high performance binary usenet uploader/poster
Stars: ✭ 65 (-25.29%)
Mutual labels:  uploader
Web File Uploader
A simple tool to let people upload and share images and files
Stars: ✭ 26 (-70.11%)
Mutual labels:  uploader
Gokapi
Lightweight selfhosted Firefox Send alternative without public upload
Stars: ✭ 84 (-3.45%)
Mutual labels:  uploader
Weui Sass
sass version for weui
Stars: ✭ 55 (-36.78%)
Mutual labels:  weui
Vue2 Multi Uploader
Drag and drop multiple file uploader with Vue.js v2 and Axios
Stars: ✭ 77 (-11.49%)
Mutual labels:  uploader
Closify
Closify provide a quick and intuitive JS plugin that facilitate acquiring images with different dimensions
Stars: ✭ 47 (-45.98%)
Mutual labels:  uploader
Tus Php
🚀 A pure PHP server and client for the tus resumable upload protocol v1.0.0
Stars: ✭ 1,048 (+1104.6%)
Mutual labels:  uploader
Cd It Job
针对成都IT小伙伴们的工作(招聘,求职)交流的微信订阅号项目。
Stars: ✭ 68 (-21.84%)
Mutual labels:  weui
Grapesjs Plugin Filestack
Enable Filestack uploader inside the Asset Manager
Stars: ✭ 14 (-83.91%)
Mutual labels:  uploader
React Images Uploading
The simple images uploader applied Render Props pattern that allows you to fully control UI component and behaviors.
Stars: ✭ 80 (-8.05%)
Mutual labels:  uploader
Upload
文件上传功能
Stars: ✭ 8 (-90.8%)
Mutual labels:  uploader
Gdrivedownloader
Just enter the direct URL of the file and it will upload it to Google Drive and print download link of it.
Stars: ✭ 60 (-31.03%)
Mutual labels:  uploader
Pussh
The cross platform, multi-functional screenshot utility
Stars: ✭ 86 (-1.15%)
Mutual labels:  uploader
Gridfieldbulkeditingtools
SilverStripe GridField Components set for bulk upload and bulk record edit, unlink & delete 📦💥
Stars: ✭ 83 (-4.6%)
Mutual labels:  uploader
Flutter Picgo
🚀 A simple & beautiful mobile tool for pictures uploading built by flutter
Stars: ✭ 72 (-17.24%)
Mutual labels:  uploader

vux-uploader-component

a mobile vue component implementation for weui uploader

Install

npm install -S vux-uploader-component

Mobile demo

https://ejayyoung.github.io/vux-uploader-component/index.html

scan the qrcode and have a test in your device

Usage

Basic

<template>
  <uploader
    v-model="fileList"
    :url="remoteUrl"
    @on-change="onChange"
    @on-cancel="onCancel"
    @on-success="onSuccess"
    @on-error="onError"
    @on-delete="onDelete"
  ></uploader>
</template>
<script>
  import Uploader from "vux-uploader-component";

  export default {
    components: {
      Uploader
    },
    data() {
      return {
        fileList: []
      };
    }
  };
</script>

Custom name

<uploader
  v-model="fileList"
  :url="remoteUrl"
  name="upload"
></uploader>

Extra Params

<uploader
  v-model="fileList"
  :url="remoteUrl"
  :params="{
    token: '13579',
    linkid: '2323',
    modelname: 'modelname'
  }"
></uploader>

Manual Upload

<template>
  <uploader v-model="fileList" :autoUpload="false"></uploader>
</template>
<script>
  import Uploader from "vux-uploader-component";

  export default {
    components: {
      Uploader
    },
    data() {
      return {
        fileList: []
      };
    },
    methods: {
      submit() {
        const formData = new FormData();
        formData.append("file", fileList[0].blob);
        fetch
          .post(url, formData)
          .then(() => {})
          .catch(() => {});
      }
    }
  };
</script>

Props

property type default description
title String '图片上传' 组件标题
files Array [] 初始化数据源,通过on-fileList-change事件绑定 v-model
limit Number | String 5 限制上传图片个数
capture Number | String false 是否只选择调用相机
enableCompress Boolean true 是否压缩
maxWidth String | Number 1024 图片压缩最大宽度
quality String | Number 0.92 图片压缩率
url String - 上传服务器 url
headers Object {} 上传文件时自定义请求头
withCredentials Boolean - 设置为true的话,支持标准CORS设置cookie值
params Object - 上传文件时自定义参数
name String 'file' 上传文件时 FormData 的 Key,默认为 file
autoUpload Boolean true 是否自动开启上传
multiple String | Boolean "" 是否支持多选, false为不支持
readonly Boolean false 只读模式(隐藏添加和删除按钮)

Events

event param description
on-change (FileItem, FileList) 选完照片,删除照片时,FileList 变化时触发,返回当前改变的 FileItem,以及当前的 FileList
on-cancel () 选择照片后取消的回调,用于错误提示
on-success (result, fileItem) 上传请求成功后的回调,返回远程请求的返回结果,及当前添加文件的 FileItem
on-error (xhr) 上传请求失败后的回调,返回xhr
on-delete (cb) 删除照片时的回调,返回隐藏 Previewer,删除图片的回调,没监听onDelete事件的时候,直接执行删除回调

v-model

通过 v-model 可以在组件外部获取更新的组件的FileList

返回的 FileItem 格式

目前将 File 对象的属性复制组成 FielItem, FileItem 组成 FileList,便于用户获取 File 对象的信息

{
  "blob": Blob,
  "fetchStatus": "success",
  "lastModified": 1552382376925,
  "lastModifiedDate": "Tue Mar 12 2019 17:19:36 GMT+0800 (中国标准时间)",
  "name": "YourImage.jpeg",
  "progress": 100,
  "size": 68905,
  "type": "image/jpeg",
  "url": "blob:http://0.0.0.0:8080/e3a87d67-a1dc-4909-b5fa-7bb3a7baad11"
}

Todo

  • [x] 调用手机相机
  • [x] 获取图片并渲染到浏览器
  • [x] 解决图片 EXIF 旋转
  • [x] 预览图片
  • [x] 删除图片
  • [x] 支持上传图片配置
  • [x] 显示上传进度
  • [x] 支持多选
  • [x] 支持 v-model 获取 FileList
  • [X] 接入Photoswipe,增强预览功能
  • [X] xhr支持自定义头部和withCredentials
  • [ ] 改为vue-cli 3.0 打包

Development

# install dependencies
npm install

# serve with hot reload at http://0.0.0.0:8080/
npm run dev

# build for production with minification
npm run build:prod

# publish package
npm version patch
npm publish

For detailed explanation on how things work, consult the docs for vue-loader.

Relevant

License

The MIT License

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].