computer object name
computer object name
selectOsHandler = (value, type) => {
this.selectHandlerGenerator(value, type);
};
selectVersionHandler = (value, type) => {
this.selectHandlerGenerator(value, type);
};
selectHandlerGenerator = (value, type = ``) => {
const stateObj = {};
const payloadObj = {};
stateObj[`default${type}Option`] = value;
payloadObj[`active${type}`] = value;
const {
dispatch,
} = this.props;
this.setState(stateObj, () => {
dispatch({
type: `dashboard/update${type}`,
payload: payloadObj,
});
this.props.initData();
});
};
pure function components
import React, {
// Component,
// useState,
// useEffect,
} from 'react';
const CommonTitle = (props) => {
const {
startDate,
endDate,
title,
style: {
titleClass,
textClass,
},
} = props;
return(
<>
<p className={titleClass}>
{title}
</p>
<p className={textClass}>
{`最近一个月 (${startDate} ~ ${endDate})`}
</p>
</>
);
};
export default CommonTitle;
export {
CommonTitle,
};
import React, {
// Component,
// useState,
// useEffect,
} from 'react';
import {
Radio,
} from "antd";
const {
Group: RadioGroup,
Button: RadioButton,
} = Radio;
const CommonRadioGroup = (props) => {
const {
selected,
radioChangeHanlder,
tabs,
radios,
style,
} = props;
return(
<>
<RadioGroup
className="radio-group"
defaultValue={selected}
onChange={e => radioChangeHanlder(e)}
style={style}>
{
tabs.map(
(item, i) => (
<RadioButton
className="radio-button"
value={radios[i]}
key={radios[i]}>
{item}
</RadioButton>
)
)
}
</RadioGroup>
</>
);
};
export default CommonRadioGroup;
export {
CommonRadioGroup,
};
本文首发于博客园,作者:xgqfrms,原文链接:https://www.cnblogs.com/xgqfrms/p/11688515.html
未经授权禁止转载,违者必究!