comp-sidebar
v1.0.23
Published
basic react component
Downloads
5
Readme
comp-sidebar
API
| 属性 | 说明 | 类型 | 默认值 |
| ---- | ---- | ---- | ---- |
| logoUrl | logo 链接 | String | |
| openMode | 新页面打开方式,同 a.target | String | _blank |
| dataSource | 源数据 | Array | |
| openKeys | 初始展开的 SubMenu 菜单项 key 数组 | Array | |
| selectedKeys | 初始选中的菜单项 key 数组 | Array | |
| theme | 主题颜色,支持 dark
或者 light
| String | dark |
Example
import React from 'react';
import { render } from 'react-dom';
import { Layout } from 'antd';
import CompSidebar from 'comp-sidebar';
const data = [
{
title: '酒店业务',
key: 'hotel',
entries: [
{
title: '酒店产品',
key: 'key1',
link: 'link1.html'
},
{
title: '渠道运营',
key: 'key2',
link: 'link2.html'
},
{
title: '订单管理',
key: 'key3',
link: 'order.html'
}
]
},
{
title: '合作伙伴',
key: 'partner',
entries: [
{
title: '供应商管理',
key: 'key3',
link: 'link3.html'
},
{
title: '分销商管理',
key: 'key4',
link: 'link4.html'
}
]
}
];
render(
<Layout style={{height: '100%'}}>
<CompSidebar
logoUrl="https://gw.alipayobjects.com/zos/rmsportal/KDpgvguMpGfqaHPjicRK.svg"
dataSource={data}
openKeys={['hotel']}
selectedKeys={['key1']}
theme="dark"
/>
</Layout>,
document.getElementById('app')
);
Develop
$ npm run start
Publish
$ cd ../.. // 返回项目根目录,通过 `lerna` 来构建与发布
$ npm run build
$ npm publish