import React from "react";
import Money from "./components/Money";
class App extends React.Component {
// state
state = {
dollar: '',
money: ''
}
transformRmb = (value) => {
this.setState({
// 保留后两位 并判断value值
dollar: value === '' ? '' : (value * 7.2456).toFixed(2),
money: value
})
}
transformMy = (value) => {
this.setState({
dollar: value,
// 保留后两位 并判断value值
money: value === '' ? '' : (value * 0.138).toFixed(2)
})
}
render() {
return (
export default function Money(props) {
function changeHandler(e){
// 7.2456
props.transform(e.target.value)
}
return (