UNPKG

cjd-parkball

Version:

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

72 lines (60 loc) 1.25 kB
--- category: 2 title: 国际化 title_en: Internationalization --- zh-CN 设置 `okText``cancelText` 以自定义按钮文字。 en-US To customize the text of the buttons, you need to set `okText` and `cancelText` props. ````jsx import { Modal, Button } from 'parkball'; class LocalizedModal extends React.Component { state = { visible: false } showModal = () => { this.setState({ visible: true, }); } hideModal = () => { this.setState({ visible: false, }); } render() { return ( <div> <Button type="primary" onClick={this.showModal}>Modal</Button> <Modal title="Modal" visible={this.state.visible} onOk={this.hideModal} onCancel={this.hideModal} okText="确认" cancelText="取消" > <p>Bla bla ...</p> <p>Bla bla ...</p> <p>Bla bla ...</p> </Modal> </div> ); } } function confirm() { Modal.confirm({ title: 'Confirm', content: 'Bla bla ...', okText: '确认', cancelText: '取消', }); } ReactDOM.render( <div> <LocalizedModal /> <br /> <Button onClick={confirm}>Confirm</Button> </div>, mountNode ); ````