@beisen/react-width-provider

1.1.0 • Public • Published

How To

import widthProvider from '@beisen/react-width-provider';

@widthProvider('width') //指定存在props中的key,如果不传,侧为width
class MyClass extends React.Component {
    render(){
        return <div style={{width: '50%'}}>
            数据会随着窗口大小的变化而变化
            {this.props.width}
        </div>
    }
}

export default MyClass

使用widthProvider包装过的组件,在this.props.中始终都能获取到自己的宽度

例子

git clone git@gitlab.beisencorp.com:ux-cnpm/ux-react-width-provider.git
cd ux-react-width-provider
npm install
npm run example

安装

npm install --save @beisen/react-width-provider

Readme

Keywords

none

Package Sidebar

Install

npm i @beisen/react-width-provider

Weekly Downloads

4

Version

1.1.0

License

ISC

Last publish

Collaborators

  • beisencorp