All Projects → greedying → Vux Uploader

greedying / Vux Uploader

Projects that are alternatives of or similar to Vux Uploader

Vue Clazy Load
Component-based lazy (CLazy) load images in Vue.js 2
Stars: ✭ 106 (-22.63%)
Mutual labels:  vue-components
Vuex Shopping Cart
🛒 Shopping cart built with Vue and Vuex
Stars: ✭ 118 (-13.87%)
Mutual labels:  vue-components
Vue Markdown
A Powerful and Highspeed Markdown Parser for Vue
Stars: ✭ 1,696 (+1137.96%)
Mutual labels:  vue-components
Maz Ui
Stand-alone components library to build your interfaces with Vue.JS & Nuxt.JS
Stars: ✭ 109 (-20.44%)
Mutual labels:  vue-components
Vue Graph
⚡️ Vue components based on the JUI chart available in Vue.js
Stars: ✭ 114 (-16.79%)
Mutual labels:  vue-components
Vue Form Components
Clean & minimal vue form elements and form builder with validation
Stars: ✭ 120 (-12.41%)
Mutual labels:  vue-components
Ymu
vue components based on VueJS
Stars: ✭ 104 (-24.09%)
Mutual labels:  vue-components
Balm Ui
♦️ A modular and customizable UI library based on Material Design and Vue
Stars: ✭ 133 (-2.92%)
Mutual labels:  vue-components
Vue Flashcard
Rich flashcard component for vue js 2 🎉
Stars: ✭ 114 (-16.79%)
Mutual labels:  vue-components
Vue Loaders
Vue + loaders.css
Stars: ✭ 127 (-7.3%)
Mutual labels:  vue-components
Vue Generator
A CLI generator for Vue components, views and store modules
Stars: ✭ 111 (-18.98%)
Mutual labels:  vue-components
Vue Tables 2
Vue.js 2 grid components
Stars: ✭ 1,518 (+1008.03%)
Mutual labels:  vue-components
V Dialogs
A simple and clean instructional dialog plugin for Vue2, dialog type including Modal, Alert, Mask and Toast
Stars: ✭ 121 (-11.68%)
Mutual labels:  vue-components
Vue Parallax Js
Tiny vue component that adds a directive for parallax effect on elements.
Stars: ✭ 107 (-21.9%)
Mutual labels:  vue-components
Vue3 News
🔥 Find the latest breaking Vue3、Vue CLI 3+ & Vite News. (2021)
Stars: ✭ 2,416 (+1663.5%)
Mutual labels:  vue-components
Vue Spinkit
🌀 A collection of loading indicators animated with CSS for VueJS
Stars: ✭ 105 (-23.36%)
Mutual labels:  vue-components
Vue Fullpage.js
Official Vue.js wrapper for fullPage.js http://alvarotrigo.com/vue-fullpage/
Stars: ✭ 1,626 (+1086.86%)
Mutual labels:  vue-components
Vue Canvas Nest
💫 A Vue.js background component for canvas-nest.
Stars: ✭ 136 (-0.73%)
Mutual labels:  vue-components
Laravel cities
Find any country/city in the world. Get Long/Lat etc. Deploy geonames.org database localy. Optimized DB tree
Stars: ✭ 133 (-2.92%)
Mutual labels:  vue-components
Storefront Ui
Customization-first, performance-oriented and elegant UI framework for eCommerce (and not only) based on Vue.js and Google Retail UX Playbook. Made with 💚 by Vue Storefront team and contributors.
Stars: ✭ 1,827 (+1233.58%)
Mutual labels:  vue-components

vux-uploader

vux-uploader是什么

vux-uploader是一个vue的上传组件,是对vux组件库的一个补充。
因为vux并没有对weuiuploader组件进行封装,理由见vux issue 682,但这又是一个常见需求。在使用vux过程中,作者实现了这个组件,现整理开源出来,命名为vux-uploader。

vux-uploader的特点

  • 基于vux,适合vux项目
  • 暂时不支持vux $t方式的多语言功能
  • 增加了删除按钮,点击则删除第一张图片
  • 内置图片上传、增加、删除功能,但暂时每次只能操作一张图片
  • 接上,允许用户监听事件,自己实现上传、增加、删除功能
  • 使用axios进行图片上传

快速使用

  1. 检查项目是否符合使用条件
  • 需要是使用vux2的项目
  • 需要安装babelES6部分语法进行转码
  • 需要安装less-loader正确编译less源码
  • 只支持webpack的方式,暂不提供umd
  1. 安装vux-uploader
npm install vux-uploader --save
  1. 使用vux-uploader
// 引入组件
import Uploader from 'vux-uploader'
// 子组件
export default {
  ...
  components: {
    ...
    Uploader,
    ...
  }
  ...
}
  // 使用组件
  <uploader
    :max="varmax"
    :images="images"
    :handle-click="true"
    :show-header="false"
    :readonly="true"
    :upload-url="uploadUrl"
    name="img"
    :params="params"
    size="small"
    @preview="previewMethod"
    @add-image="addImageMethod"
    @remove-image="removeImageMethod"
  ></uploader>

props说明

  • images

    • 类型: Array
    • 默认值: [],空数组
    • 含义: 图片数组,格式为 [ { url: '/url/of/img.ong' }, ...]
    • 备注: 变量为数组时,数据流为双向,在组件内部改变数组的值影响父组件
  • max

    • 类型: Number
    • 默认值: 1
    • 含义: 图片最大张数
    • 备注: 图片达到max值时,新增按钮消失
  • showHeader

    • 类型: Boolean
    • 默认值: true
    • 含义: 是否显示头部
    • 备注: 控制整个头部的显示
  • title

    • 类型: String
    • 默认值: 图片上传
    • 含义: 头部的标题
    • 备注: 不显示则留空
  • showTip

    • 类型: Boolean
    • 默认值: true
    • 含义: 是否显示头部数字部分,即1/3部分
    • 备注: 当showHeaderfalse时,header整体隐藏,此时本参数无效
  • readonly

    • 类型: Boolean
    • 默认值: false
    • 含义: 是否只读
    • 备注: 只读时,新增和删除按钮隐藏
  • handleClick

    • 类型: Boolean
    • 默认值: false
    • 含义: 是否接管新增按钮的点击事件,如果是,点击新增按钮不再自动出现选择图片界面
    • 备注: true时,点击新增按钮,则$emit('add-image'),可以在此事件内进行自定义的选择图片等操作,此后图片的新增、上传、删除都由使用者接管
  • autoUpload

    • 类型: Boolean
    • 默认值: true
    • 含义: 选择图片后是否自动上传。是,则调用内部上传接口。否,则$emit('upload-image', formData)',formData`为图片内容,用户可监听事件自己上传
    • 备注: handleClick为true时,无法进行图片选择,故此参数无效。此参数为false时,选择图片后,$emit('upload-image', formData)',formData`为图片内容
  • uploadUrl

    • 类型: String
    • 默认值: ''
    • 含义: 接收上传图片的url
    • 备注: 需要返回如下格式的json字符串,否则请设置autoUploadfalse自行上传
  { 
    result: 0,
    message: "result不是0时候的错误信息",
    data: {
      url: "http://image.url.com/image.png"
    }
  }
  • name

    • 类型: String
    • 默认值: img
    • 含义: 默认上传的时候,图片使用的表单name
    • 备注: 无
  • params

    • 类型: Object
    • 默认值: null
    • 含义: 上传文件时携带参数
    • 备注: 无
  • size

    • 类型: String
    • 默认值: normal
    • 含义: 尺寸类型
    • 备注: normalweui默认尺寸,small为作者定义的小一些的尺寸
  • capture

    • 类型: String
    • 默认值: ''
    • 含义: input 的capture属性
    • 备注: 可以设置为camera,此时点击新增按钮,部分机型会直接调起相机,注意,各型号手机表现不同,请谨慎使用。handleClick为true时,此属性无效

emit事件说明

  • add-image

    • emit时机: 当handleClick参数为true时,点击新增按钮
    • 参数: 无
    • 备注: 无
  • remove-image

    • emit时机: 当handleClick参数为true时,点击删除按钮
    • 参数: 无
    • 备注: 当handleClickfalse时,点击删除按钮,组件内部删除第一张图片;否则,用户需要监听本事件,并进行相应删除操作
  • preview

    • emit时机: 点击任意一张图片的时候
    • 参数: 图片对象,格式为 { url: 'imgUrl' }
    • 备注: 暂时没有实现自动预览功能,如果需要用户监听事件自行实现
  • upload-image

    • emit时机: handleClick和autoUpload都为false`时,选择图片
    • 参数: formData,图片内容生成的formData
    • 备注: 可以通过vm.$refs.input获取图片的input元素

待实现事项,欢迎PR

  • [ ] 上传进度实时显示
  • [ ] 上传错误时,图片显示错误样式
  • [ ] 一次选择,多图片上传
  • [ ] 其他未实现事项
  • [ ] formData 中 'img' 可以配置
  • [x] 上传图片时,附带post参数+16

感谢与参考

疑问与讨论

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].