# @stofe/sui-navigation

> --- title: 使用文档 ---

Latest version **0.1.2** (published 2020-06-19) · MIT license · 0 weekly downloads

## Install

```sh
npm install @stofe/sui-navigation
pnpm add @stofe/sui-navigation
yarn add @stofe/sui-navigation
bun add @stofe/sui-navigation
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.2 |
| Published | 2020-06-19 |
| First published | 2020-06-15 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 1.3 MB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Cone - Cainiao Inc,Alibaba group. |
| Maintainers | rentj1 |
| Keywords | Cone, react, component |

## Links

- npm: https://www.npmjs.com/package/@stofe/sui-navigation
- Homepage: https://unpkg.com/@stofe/sui-navigation@0.1.1/build/index.html
- npm.io page: https://npm.io/package/@stofe/sui-navigation

## Dependencies (1)

- [@alifd/next](https://npm.io/package/@alifd/next.md) ^1.x

## Alternatives

- [mobx-react](https://npm.io/package/mobx-react.md) — 2.8M weekly downloads
- [rc-tree](https://npm.io/package/rc-tree.md) — 2.6M weekly downloads
- [@react-oauth/google](https://npm.io/package/@react-oauth/google.md) — 1.3M weekly downloads
- [@wagmi/connectors](https://npm.io/package/@wagmi/connectors.md) — 877.0K weekly downloads
- [vee-validate](https://npm.io/package/vee-validate.md) — 836.4K weekly downloads

## Recent versions

- 0.1.2 (latest) — 2020-06-19
- 0.1.1 — 2020-06-15

## README

---
title: 使用文档
---

# sui-navigation
一般用于站点左侧弹出导航, 可以通过单独安装组件或者组件库两种方式使用

## 组件使用方式
$ snpm install @stofe/sui-navigation --save
````jsx
import Navigation from '@stofe/sui-navigation'
````


## 组件库使用方式
`$ snpm install @stofe/sui  --save`

````jsx
import { Navigation } from '@stofe/sui'
````

## API

| 参数 | 说明 | 类型 | 可选值 | 默认值 |
|------|------|------|------|------|
| dataSource | 菜单内容 | array | true | - |
| activeKey | 当前选中的节点的key，默认非受控 | string | false | - |
| footer | 导航栏底部，用于自定义底部内容 | node | false | noop |
| hasDing | 是否有固定锚点 | bool | false | false |
| dingMap | 固定锚点配置 | object | false | {} |
| onDing | 固定锚点点击事件 | func | false | noop |
| onItemClick | 菜单选中的方法 | func | func | noop |
| onClose | 导航关闭 | func | func | noop |
| iconRender | icon函数，默认使用<Icon type={name} />，业务可以自定义函数 | func | func | noop |


## 示例

```
import { Drawer } from 'next'
import Navigation from '@stofe/sui-navigation'
const dataSource = [
  {
    "title": "财务中心",
    "url": "/page/fin-center",
    "icon": "caiwuzhongxin",
    "children": [
      {
        "title": "报价管理",
        "url": "/page/fin-center/quote",
        "id": "133",
        "disabled": false,
        "index": 10
        "children": [
          {
            "title": "报价资料",
            "url": "/page/fin-center/quote/quote-info/list",
            "id": "134",
            "disabled": false,
            "index": 30
          }
        ],
      }]
    ]
  }
]


class Demo extends React.Component {
  constructor(props) {
    super(props);
    this.state = {
      visible: false
    };
  }

  onNavOpen = () => {
    this.setState({ visible: true });
  }

  onNavClose = () => {
    this.setState({ visible: false });
  }

  render() {
    const { visible } = this.state;
    return (
      <div className="demo-container" data-title="DEMO">
        <header>
          <Icon type="toggle-right" size="large" onClick={this.onNavOpen} />
        </header>
        <Drawer
          visible={visible}
          width={440}
          placement="left"
          onClose={this.onNavClose}
          className="demo-drawer"
          bodyStyle={{
            padding: 0,
            height: '100%',
            border: 'none'
          }}
        >
          <Navigation
            dataSource={dataSource}
          />
        </Drawer>
      </div>
    );
  }
}
```

## LICENSE

---
_Source: https://npm.io/package/@stofe/sui-navigation · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
