--- order: 7 title: 自定义位置 --- `1.0` 之后,Modal 的 `align` 属性被移除,您可以直接使用 `style.top` 或配合其他样式来设置对话框位置。 ````jsx import { Modal, Button } from 'antd'; const App = React.createClass({ getInitialState() { return { visible: false }; }, setModalVisible(visible) { this.setState({ visible }); }, render() { return (
this.setModalVisible(false)} onCancel={() => this.setModalVisible(false)}>

对话框的内容

对话框的内容

对话框的内容

); }, }); ReactDOM.render(, mountNode); ```` ````css /* 使用 css 技巧来动态设置的对话框位置 */ .vertical-center-modal .ant-modal-content { transform: translateY(-50%); } ````