简体   繁体   English

Semantic-ui react modal 速记防止按钮关闭模态

[英]Semantic-ui react modal shorthand prevent button closing modal

Using the code on the docs page shown below for a shorthand modal, how do i stop the button from closing the modal in the actions property?使用下面显示的文档页面上的代码作为速记模式,如何阻止按钮关闭操作属性中的模式? Ive tried preventDefault, no luck, its got me stumped?我试过preventDefault,没有运气,它让我难住了?

import React from 'react'
import { Button, Modal } from 'semantic-ui-react'

const ModalExampleShorthand = () => (
  <Modal
    trigger={<Button>Show Modal</Button>}
    header='Reminder!'
    content='Call Benjamin regarding the reports.'
    actions={['Snooze', { key: 'done', content: 'Done', positive: true }]}
  />
)

export default ModalExampleShorthand

不敢相信我没有想到这一点,我只需要在动作中添加 onClick 处理程序,即:

actions={['Snooze', { key: 'done', content: 'Done', positive: true, onClick: myFunc }]}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM