Socket
Book a DemoInstallSign in
Socket

dd-rc-layout

Package Overview
Dependencies
Maintainers
1
Versions
41
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

dd-rc-layout

layout

0.3.5
latest
npmnpm
Version published
Weekly downloads
1
Maintainers
1
Weekly downloads
 
Created
Source

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

Keywords

react

FAQs

Package last updated on 23 Aug 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.