0.3.5 • Published 9 years ago

dd-rc-layout v0.3.5

Weekly downloads
1
License
MIT
Repository
-
Last release
9 years ago

dd-rc-layout


基于 react + react-router + antd 制定的两种常用布局。

安装

dd-rc-layout

import { Layout } from 'dd-rc-layout';

const App = React.createClass({
  render(){
    const navs = [
      {
        name: 'item_1',
        IndexLink: true,
        icon: 'mail',
        to: '/MenuItem_1'
      }
    ];
    return (
      <Layout
        mode="ui_1"
        appName="Layout"
        userName="userName"
        navs={[
          {
            name: 'item_1',
            IndexLink: true,
            icon: 'mail',
            to: '/MenuItem_1',
          }
        ]}
        footer="版权...."
        headerCustomize={[
          <li key="1"><a>自定义1</a></li>,
          <li key="2"><a>自定义2</a></li>
        ]}
      >
        {this.props.children}
      </Layout>
    )
  }
)}

let routeConfig = [
  { 
    path: '/',
    component: App,
    indexRoute: { component: MenuItem_1 },
    childRoutes: [
      { 
        path: 'MenuItem_1',
        component: MenuItem_1
      }, { 
        path: 'MenuItem_2',
        component: MenuItem_2,
        childRoutes: [
          { path: '/MenuItem_2_sub_1', component: MenuItem_2_sub_1 }
        ]
      }
    ]
  }
];

const routes = (
  <Router routes={routeConfig} />
);

ReactDOM.render(routes, document.getElementById('react-content'));

API

参数说明类型默认值
mode布局类型, ui_1为左右布局, ui_2为上下布局, ui_3带节点树布局enum: ui_1 ui_2 ui_3'ui_1'
appName站点名称string
appLogo站点logo地址string
userName登录获取用户名,值为false时关闭显示用户名,其他情况开启。为函数时必须返回一个 Promise 对象,resolve 的第一个参数为用户名字符串;不设置该参数或为true时,通过当前域名下的/login/username获取用户名。boolean|string|function
logoutApi退出登录接口string'./logout'
footer底部信息string
navs导航栏配置object
breadcrumb面包屑(上下布局可以设置是否显示)booleanfalse
headerCustomize头部右侧自定义空间String or React.Element

navs

导航栏配置

参数说明类型默认值
name栏目名称string
IndexLink是否为首页boolean
icon图标string
to链接地址string
queryqueryobject
children子栏目object
treeHide是否隐藏左侧节点树booleanfalse
hide是否隐藏booleanfalse

nstree

nstree配置

参数说明类型默认值
treeApi节点树接口string
nstreeBeforeInit初始化前回调function
nstreeAfterInit初始化后回调function
zTreeObjSettingztree配置object
nstreeSearchsearch模块配置object
nstreePathSep节点空间分隔符号string.

License

MIT

0.3.5

9 years ago

0.3.4

9 years ago

0.3.3

9 years ago

0.3.2

9 years ago

0.3.1

9 years ago

0.3.0

9 years ago

0.2.9

9 years ago

0.2.8

9 years ago

0.2.7

9 years ago

0.2.6

9 years ago

0.2.5

9 years ago

0.2.4

9 years ago

0.2.3

9 years ago

0.2.2

9 years ago

0.2.1

9 years ago

0.2.0

9 years ago

0.1.9

9 years ago

0.1.8

9 years ago

0.1.7

9 years ago

0.1.6

9 years ago

0.1.5

9 years ago

0.1.4

9 years ago

0.1.3

9 years ago

0.1.1

9 years ago

0.1.0

9 years ago

0.0.19

9 years ago

0.0.18

9 years ago

0.0.17

9 years ago

0.0.16

9 years ago

0.0.15

9 years ago

0.0.14

10 years ago

0.0.13

10 years ago

0.0.12

10 years ago

0.0.11

10 years ago

0.0.10

10 years ago

0.0.8

10 years ago

0.0.7

10 years ago

0.0.6

10 years ago

0.0.5

10 years ago

0.0.4

10 years ago

0.0.3

10 years ago

0.0.2

10 years ago