0.0.7 • Published 5 years ago
italent-tabs v0.0.7
italent 动态业务组件
接入方法
import React, { Component } from 'react';
import styled from 'styled-components';
import Tabs from '../../src/index'
import channels from './mock'
const TabsWrapper = styled.div``
export default class Demo extends Component {
fetchData = (channelId) => {
//抛出频道id
console.log(channelId)
}
render() {
return <TabsWrapper>
<Tabs channels={channels.channels}
fetchFeedData={this.fetchData} />
</TabsWrapper>
}
}
- 数据格式
"channels": [
{
"id": 1,
"name": "与我相关",
"code": "",
"type": 0,
"subChannels": [
{
"id": 2,
"name": "全部",
"code": null,
"type": 0,
"subChannels": null
}
]
},
{
"id": 50,
"name": "",
"code": "",
"type": 1,
"subChannels": [
{
"id": 101,
"name": "工作计划",
"code": "",
"type": 0,
"subChannels": [
{
"id": 102,
"name": "全部",
"code": null,
"type": 0,
"subChannels": null
},
{
"id": 106,
"name": "分享",
"code": null,
"type": 0,
"subChannels": null
},
{
"id": 107,
"name": "签到",
"code": null,
"type": 0,
"subChannels": null
}
]
},
{
"id": 151,
"name": "招聘",
"code": "",
"type": 0,
"subChannels": [
{
"id": 152,
"name": "全部",
"code": null,
"type": 0,
"subChannels": null
},
{
"id": 156,
"name": "筛选简历",
"code": null,
"type": 0,
"subChannels": null
},
{
"id": 157,
"name": "申请",
"code": null,
"type": 0,
"subChannels": null
}
]
}
]
}
]
// 需要传入一个channel格式的数组
//一级标签 type = 0为普通文本格式 type=1为下列列表(主要针对动态菜单定制)
//支持通过subChannels传入子筛选条件