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

@cutting-mat/uploader-plus

v0.1.2

Published

基于 ElementPlus,整合图片上传前压缩、上传前剪裁、IOS 图片方向自动校正、自定义文件类型的 Vue 上传组件

Downloads

1

Readme

@cutting-mat/uploader-plus

npm license

基于 ElementPlus,整合图片上传前压缩、上传前剪裁、IOS 图片方向自动校正、自定义文件类型的 Vue 上传组件

Feature

  • [x] 支持全局配置
  • [x] 支持 v-model 受控模式
  • [x] 图片上传前压缩
  • [x] 图片上传前剪裁
  • [x] 拍照方向自动校正(需开启压缩或剪裁)
  • [x] 自定义 accept 类型集合

Quick Start

  1. NPM 安装
npm i @cutting-mat/uploader-plus -S
  1. 安装插件
import uploader from "@cutting-mat/uploader-plus";
import uploadConfig from "@/upload.config";
Vue.use(uploader, uploadConfig); // 安装时传入的配置为全局配置
  1. 使用组件
<uploader :uploadMethod="(file, fileName) => {...}"> 点击上传 </uploader>

Config

/**
 * @cutting-mat/uploader-plus 配置文件
 * 支持 el-upload 除请求相关(action, headers, data, name, with-credentials, http-request)以外的所有 Prop
 * 支持 el-upload 的所有 Method
 * 附 el-upload 文档: https://element.eleme.cn/#/zh-CN/component/upload
 *
 * 额外支持以下属性,均支持全局配置:

 * accept[String]:              允许上传的文件类型, 同el-upload, 额外支持自定义文件类型(见下方 quickType )
 * v-model / value[Array]:      已上传文件数据, 同el-upload, default: []
 * beforeUpload[Function]:      上传文件之前的钩子,同el-upload
 * onExceed[Function]:          文件超出个数限制时的钩子, 同el-upload
 * limitSize[Number]:           允许上传的最大文件尺寸,默认 100 * 1024 * 1024(100M)
 * imgCompress[Boolean]:        开启图片上传前压缩, default: true
 * imgCompressOption[Object]:   图片压缩尺寸配置, default:
    {
        maxWidth: 1000,            // 最大宽度
        maxHeight: 1000,           // 最大高度
    }
 * imgCrop[Boolean]:            开启图片上传前剪裁, default: false
 * imgCropOption[Object]:       图片剪裁配置, 选项同 [fengyuanchen/compressorjs], default:
    {
        ratio: 1,               // 剪裁框宽高比
        minWidth: 0,            // 最小输出宽度
        minHeight: 0,           // 最小输出高度
        maxWidth: 1000,         // 最大输出宽度
        maxHeight: 1000,        // 最大输出高度
    }
 * uploadMethod[Function]:      上传处理方法, 接收两个参数(file/blob, fileName),default: 无
 * responseTransfer[Function]:  接口返回数据 与 fileList 数据格式转换函数, default: (response) => return response;
 * BeforeUploadError[Function]: 上传前校验失败回调,接受info参数:{message: "超出上传数量限制", type: 'warning' }
 * quickType[Object]:           自定义文件类型, default:
    {
        "t-image": [".jpg", ".jpeg", ".png", ".gif", ".bmp", ".webp"],
        "t-video": [".mp4", ".rmvb", ".avi", ".mov", ".3gp", ".webm"],
        "t-audio": [".wav", ".mp3", ".ogg", ".acc"],
        "t-word": [".docx", ".doc"],
        "t-excel": [".xlsx", ".xls"],
        "t-ppt": [".ppt", ".pptx"],
        "t-document": [".pdf", "t-word", "t-excel", "t-ppt"],
        "t-zip": [".zip", ".rar"],
    }

 * */