简体   繁体   中英

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?

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 }]}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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