WARNING: 不同版本的umi有不同路由生成模板, 请使用umi@2.9.6
Modal page根据react-router新特性, umi-plugin-pro-routes 会异步的生成新的新的router.js
, 然后覆盖原先的.
查看example
Configure in .umirc.js
,
export default {
plugins: [
['umi-plugin-pro-routes', { enable: true }],
],
}
Configure in any page,
/**
* modalKey: {string} // like PageOne
*/
Dipatch with router
import { router } from 'umi'
<Button
onClick={() => {
router.push({
pathname: '/modal-page/pageone',
search: 'modalKey=PageOne',
})
}}
>
弹窗
</Button>
Supper simple
{
enable?: boolean
}
MIT