This package has been deprecated

Author message:

Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.

zee-ui-hash-router

0.1.1 • Public • Published

zee-ui-hash-router

安装

tnpm i @ali/zee-ui-hash-router --save

使用

本组件使用高阶组件的形式提供, 示例代码如下:

import React from 'react'
import hashRouter from '@ali/zee-ui-hash-router'

function RoutedComponent (props) {
  const { routePage, routeData, route } = props
  const data = parseInt(routeData)

  return <div>
    <div>
      <h1>Page: {routePage}</h1>
    </div>
    <div>
      <h3>Data: {routeData}</h3>
    </div>
    <div>
      <button onClick={_ => {
        route('xxx', data + 1)
      }}>下一页</button>
    </div>
    <div>
      <a href={'#' + encodeURIComponent(`yyy?${data - 1}`)}>上一页</a>
    </div>
  </div>
}

const Router = hashRouter(RoutedComponent)

export default class Demo extends React.Component {
  constructor (props) {
    super(props)
  }

  render () {
    return (
      <div>
        <Router initPage='xxx' initData={1} />
      </div>
    )
  }
}

Package Sidebar

Install

npm i zee-ui-hash-router

Weekly Downloads

2

Version

0.1.1

License

MIT

Unpacked Size

15.7 kB

Total Files

17

Last publish

Collaborators

  • yusangeng