1.0.2 • Published 2 years ago

lofter-components v1.0.2

Weekly downloads
-
License
ISC
Repository
-
Last release
2 years ago

lofter-components

开发前置工作

  • image-upload
  • video-upload

以上接口依赖微前端node转发,调试的时候需要配置微前端测试环境域名

127.0.0.1 tlofter.hz.netease.com

图片上传

declare type BeforeUploadValueType = void | boolean | string | Blob | File;
interface Props {
  /**
   * 额外描述
   */
  hint?: string;
  /**
   * 图片url地址
   */
  value?: string;
  /**
   * 上传更改回调
   */
  beforeUpload?: (file: {
     file: RcFile,
     width: number,
     height: number
   }, FileList: RcFile[]) => BeforeUploadValueType | Promise<BeforeUploadValueType>;
  /**
   * 接收图片的类型,默认image/*
   */
  accept?: string;
  /**
   * 上传接口前缀,用于微前端,默认/api/imgUpload
   */
  prefix?: boolean;
}

视频上传

interface Props {
  /**
   * 额外描述
   */
  hint?: string;
   /**
   * 视频url地址
   */
  value?: string;
   /**
   * 上传更改回调
   */
  onChange?: (value: string) => void;
   /**
   * 接收图片的类型,默认image/*
   */
  accept?: string;
   /**
   * 上传接口前缀,用于微前端,默认/api/imgUpload
   */
  prefix?: boolean;
  /**
   * 上传前的校验函数
   */
  beforeUpload?: (file: File) => void;
}