@wii/material-sdk
TypeScript icon, indicating that this package has built-in type declarations

2.14.3 • Public • Published

wii-material-sdk

素材中心 SDK,提供素材选取功能

安装

npm install @wii/material-sdk

使用

实例化

import MaterialSDK from '@wii/material-sdk';

const material = new MaterialSDK({
  url: '',
  skey: '',
  sourceId: '',
  type: 1,
});

打开选择器

material.show({
  type: 1,
  callback: ({ list }) => {
    console.log(list);
  },
});

关闭选择器

material.hide();

SDK 配置 - SDKOptions

export interface SDKOptions {
  url: string; // 素材中心选择器地址
  sourceId: string; // 隔离标识,一般位租户 ID
  skey: string; // 鉴权 token
  type?: number; // 1 - 图片;2 - 音频;3 - 视频;4 - 文档;5 - 附件;
  width?: number; // 弹窗宽度
  height?: number; // 弹窗内容区高度
  maxCount?: number; // 最大选择数量
  onAuth?: () => void; // 鉴权失败回调
}

/@wii/material-sdk/

    Package Sidebar

    Install

    npm i @wii/material-sdk

    Weekly Downloads

    1

    Version

    2.14.3

    License

    none

    Unpacked Size

    2.12 MB

    Total Files

    37

    Last publish

    Collaborators

    • leo_
    • jerryjchen
    • chanceyliu
    • kagawa
    • jasonngao
    • qinmudi
    • wenyan0202
    • wongjorie