npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

vue-upload-folder

v1.1.0

Published

vue-upload-folder Plugin

Downloads

6

Readme

vue-upload-folder

安装

npm i vue-upload-folder

使用

import Vue from 'vue';
import VueUploadFolder from 'vue-upload-folder';

Vue.use(VueUploadFolder);
    <vue-upload-folder
      id="dropzone"
      ref="myDropzone"
      :options="dropzoneOptions"
      :action="folderUrl"
      :parentId="parentId"
      :useCustomSlot="true">
      <i class="el-icon-upload"></i>
      <div class="el-upload__text">将图片或文件夹拖到此处上传,或点击<b>上传</b>图片</div>
      <div class="upload-tips">仅支持5M以内的jpg、png、gif格式的图片</div>
    </vue-upload-folder>
    
<script>
export default {

  data() {
    return {
      // 传给dropzone的配置项
      dropzoneOptions: {
        autoProcessQueue: false, // 不立即上传
        url: 'xx', // 上传图片地址
        method: 'put', // 上传方法
        parallelUploads: 10000, // 上传张数限制
      },
      parentId: 'xxx', // 如果你拖动文件夹里面还有图片 那要传一个id 
      folderUrl: 'xx' // 创建文件夹的地址
    };
  }
};
</script>

Documentation 更多参数可看dropzone的文档

props

此组件基于 dropzone 库实现的。 相关配置参数可看官网

| prop name | type | default | description | required | | --------------- | ------- | -------- | ----------------------------------------------------------- | -------- | | id | string | dropzone | 组件定义的id名 | 必传 | | options | object | { } | dropzone 配置对象 可看dropzone官网 | 必传 | | destoryDropzone | boolean | true | 组件销毁时会销毁dropzone实例 | 不是必传 | | useCustomeSlot | boolean | false | 用户自定义的分发内容 (dropzone库有默认 一般我们自己添加) | 不是必传 | | folderUrl | String | '' | 文件夹上传地址(如果有文件夹要上传) | 选传 |

events

| Event Name | Description | | -------------------------------- | ------------------------------------------------------------ | | file-added(file) | 添加文件到dropzone | | upload-success(file, response) | 文件上传成功 获取服务端返回响应 | | upload-complete(file) | 上传完成之后被调用 无论上传成功或失败 | | upload-error(file, message, xhr) | 上传失败后被调用 | | upload-progress(file, progress) | 文件上传进度 上传发生进度发生变化 都会定期调用 获取progress参数 至少调用一次 |

methods

| 方法 | 描述 | | ------------------- | ------------------------------------------------------------ | | removeAllFiles() | 移除所有文件 正在上传的文件不会删除 如果要取消在上传的文件 翻看dropzone | | removeFile(file) | 移除dropzone区域的文件 | | getUploadingFiles() | 获取所有上传的文件 | | getQueuedFiles() | 获取所有队列的文件 | | getRejectedFiles() | 失败的文件 | | getAcceptedFiles() | 成功的文件 |


methods: {
	// 调用方法
	this.$refs.myDropzone.xxxMethod();
}