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

2.14.2 • Public • Published

wii-cms-sdk

内容中心 SDK,提供内容选取功能

安装

npm install @wii/cms-sdk

使用

实例化

import CMSSDK from '@wii/cms-sdk';

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

打开选择器

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

关闭选择器

cms.hide();

SDK 配置 - SDKOptions

export interface SDKOptions {
  url: string; // 素材中心选择器地址
  skey: string; // 鉴权 token
  type?: string; // 内容类型,article: 文章,resource: 资源;
  code?: string; // 子类型编码;
  width?: number; // 弹窗宽度
  height?: number; // 弹窗内容区高度
  mode?: 'multiple' // 多选、单选,默认单选
  maxCount?: number; // 最大选择数量
  onAuth?: () => void; // 鉴权失败回调
}

Dependents (0)

Package Sidebar

Install

npm i @wii/cms-sdk

Weekly Downloads

0

Version

2.14.2

License

none

Unpacked Size

2.08 MB

Total Files

26

Last publish

Collaborators

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