UNPKG

cjd-parkball

Version:

> 中后台业务组件库,中后台就像公园,进入需要买门票(登录),所以以 Parkball(公园球) 命名,公园内必定捕获!作为一个组件库,提供使用方法文档,方便开发者的调用

47 lines (38 loc) 776 B
--- category: 2 title: 控制关闭状态 title_en: Controlled --- zh-CN 通过 `visible` 属性控制关闭状态。 en-US By using the `visible` prop, you can control the close state of Tag. ````jsx import { Tag, Button } from 'parkball'; class Demo extends React.Component { state = { visible: true, } render() { return ( <div> <Tag closable visible={this.state.visible} onClose={() => this.setState({ visible: false })} > Movies </Tag> <br /> <Button size="small" onClick={() => this.setState({ visible: !this.state.visible })} > Toggle </Button> </div> ); } } ReactDOM.render(<Demo />, mountNode); ````