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

hft-oss-upload

v0.1.20

Published

1. 引入 ``` 1). 这种引入方式,erp中不得行 import HftOssUpload from "hft-oss-upload"; Vue.use(HftOssUpload as any);

Downloads

3

Readme

文档

  1. 引入
1). 这种引入方式,erp中不得行
import HftOssUpload from "hft-oss-upload";
Vue.use(HftOssUpload as any);

2). 按需加载,通用
import OssUpload from "hft-oss-upload";
@Component({
    components: {
      "hft-oss-upload": OssUpload.HftOssUpload
    }
})

<HftOssUpload />

main.ts
引入样式
import "hft-oss-upload/lib/hft-oss-upload.css";
  1. 参数
// 必选参数,上传的地址
@Prop({default: () => ""})action!: string;
// 产品端 必选
@Prop({default: () => ""})projectType!: string;
// 环境区分 1线上 2本地 必传 
@Prop({default: () => 1})envStatus!: number;
// 图片上传类型 必传 
@Prop({default: () => "image/png,image/jpeg,image/gif,image/jpg"})accept!: string;

// 默认外层样式
@Prop({default: () => {}})styleObj!: object;
// 经纪人id
@Prop({default: () => ""})archiveId!: string;
// C端用户id
@Prop({default: () => ""})cUserId!: string;
// 设备类型 1、2分别是安卓 ios , web 传3吧
@Prop({default: () => 3})deviceType!: number
// 是否开启多选
@Prop({default: () => false})multiple!: boolean;
// 文件最大值单位M
@Prop({default: () => 25})fileMaxSize!: number;
// 压缩图片比例 0.1到1之间
@Prop({default: () => 1})compressionRatio!: number;
// 文件压缩到指定大小 正常不做任何压缩 单位kb 如果传了这个参数 compressionRatio 将失效
@Prop({default: () => 0})compressionSize!: number;
  1. 回调事件
失败回调
@onError=onError
onError(info: {msg: string, code: ErrorCode}): void{}

export enum ErrorCode {
  // 超过尺寸
  outSize = 1,
  // 缺少参数
  lackParams = 2,
  // 超过最大数量
  outLength = 3,
  // 上传失败
  fail = 4,
}



成功回调
@onSuccess=onSuccess
onSuccess(list: Array<ImageUploadResponse>): void{}

export class ImageUploadResponse extends APIResponse{
  // 全地址
  fullUrl: string = "";
  // 文件名称
  @SerializedName("saveName")
  name: string = "";
  // 源文件名字
  oriName: string = "";
  // 前缀
  domain: string = "";
  // 文件大小
  size: number = 0;
}