npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

dd-rc-layout

v0.3.5

Published

layout

Downloads

7

Readme

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 | 面包屑(上下布局可以设置是否显示) | boolean | false | | headerCustomize | 头部右侧自定义空间 | String or React.Element | |

navs

导航栏配置

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

nstree

nstree配置

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

License

MIT