Commit bd233ac9 by haojie

1

parent d2cd6295
...@@ -81,20 +81,21 @@ export default class StartTrade extends Component<any, any> { ...@@ -81,20 +81,21 @@ export default class StartTrade extends Component<any, any> {
onReset = () => { onReset = () => {
const items = Object.keys(this.state); const items = Object.keys(this.state);
items.forEach((item: any) => { items.forEach((item: any) => {
if (typeof this.state[item] === 'string') { if (!noSubmitFields.includes(item)) {
this.setState({ if (typeof this.state[item] === 'string') {
[item]: '' this.setState({
}) [item]: ''
} else if (typeof this.state[item] === 'number') { })
this.setState({ } else if (typeof this.state[item] === 'number') {
[item]: 0, this.setState({
}) [item]: 0,
} else { })
this.setState({ } else {
[item]: [] this.setState({
}) [item]: []
})
}
} }
}) })
console.log(this.state) console.log(this.state)
} }
......
...@@ -70,20 +70,22 @@ export default class TradeDialog extends Component<any, any> { ...@@ -70,20 +70,22 @@ export default class TradeDialog extends Component<any, any> {
onReset = () => { onReset = () => {
const items = Object.keys(this.state); const items = Object.keys(this.state);
items.forEach((item: any) => { items.forEach((item: any) => {
if (typeof this.state[item] === 'string') { // 跳过不提交的字段
this.setState({ if (!noSubmitFields.includes(item)) {
[item]: '' if (typeof this.state[item] === 'string') {
}) this.setState({
} else if (typeof this.state[item] === 'number') { [item]: ''
this.setState({ })
[item]: 0, } else if (typeof this.state[item] === 'number') {
}) this.setState({
} else { [item]: 0,
this.setState({ })
[item]: [] } else {
}) this.setState({
[item]: []
})
}
} }
}) })
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment