2024-08-27 10:10:05 +08:00

22 lines
472 B
JavaScript

import React from 'react';
function Money(props) {
function handleChange(e){
// 在子组件中,要做的事情很简单,将用户数据的值,传递给父组件
// 让父组件来进行修改
props.transform(e.target.value);
}
return (
<fieldset>
<legend>{props.text}</legend>
<input type="text" value={props.money} onChange={handleChange}/>
</fieldset>
);
}
export default Money;