【发布时间】:2019-12-12 15:56:12
【问题描述】:
考虑以下示例:
import React, { Component } from 'react'
import { Form } from 'semantic-ui-react'
class FormExample extends Component {
state = {}
handleChange = (e, { name, value }) => this.setState({ [name]: value })
handleSubmit = () => this.setState({ email: '', name: '' })
render() {
const { name, email } = this.state
return (
<Form onSubmit={this.handleSubmit}>
<Form.Group>
<Form.Input placeholder='Name' name='name' value={name} onChange={this.handleChange} />
<Form.Input placeholder='Email' name='email' value={email} onChange={this.handleChange} />
<Form.Button attached='bottom' content='Submit' />
</Form.Group>
</Form>
)
}
}
当附加Form.Button 时,单击它不会导致表单提交。当attached 属性被省略时,onSubmit 处理程序按预期工作。
这是预期行为还是我应该在 GitHub 上提交错误问题?
【问题讨论】:
-
attached 不是 Form.Button 的有效道具。它仅适用于 Button。
标签: javascript reactjs button onsubmit semantic-ui-react