0.1.3 • Published 3 years ago
edu-react-my-class-group-selector v0.1.3
edu-react-my-class-group-selector
钉钉教育「选班级群」React 组件
安装
yarn add edu-react-my-class-group-selector
API
import {
MyClassGroupSelectorOfDesktop,
MyClassGroupSelectorOfMobile,
// 类型
IMyClassGroupSelectorProps
IClassGroup,
} from 'edu-react-my-class-group-selector';
// desktop 和 mobile API 一致
ReactDOM.render(
<MyClassGroupSelectorOfDesktop
groups={groups}
defaultValue={ defaultValue }
onChange={
(selectedGroups) => console.log(selectedGroups)
}
/>,
mountNode,
)
IClassGroup
属性 | 说明 | 类型 | 默认值 |
---|---|---|---|
groupName | 群名 | string | - |
groupType | 群类型 | 'officialClassGroup' | 'teacherStudentGroup' | - |
groupAvatar? | 群头像 | string | - |
classId | 班级 id | number | - |
className | 班级名(部门) | string | - |
studentCount? | 班级学生数 | number | - |
IMyClassGroupSelectorProps
属性 | 说明 | 类型 | 默认值 |
---|---|---|---|
defaultValue? | 默认值选中值 | IClassGroup[] | - |
value? | 指定选中值 | IClassGroup[] | - |
groups? | 群列表 | IClassGroup[] | - |
onChange? | 选中值变化时的回调,注意返回的数组 | (selected: IClassGroup[]) => void; | - |
教育开放数据源
- http 文档
- https://open.taobao.com/api.htm?docId=49885&docType=2
- 需要将 接口的 response 数据转换为
IClassGroup[]
类型传递给MyClassGroupSelectorOfDesktop
组件的groups
属性