日期按钮组件

image.png
Radio.Group options 动态渲染

  1. import { Radio } from 'antd';
  2. const options = [
  3. { label: '1小时', value: 1 },
  4. { label: '6小时', value: 6 },
  5. { label: '12小时', value: 12 },
  6. { label: '1天', value: 24 },
  7. { label: '3天', value: 72' },
  8. { label: '5', value: 120 },
  9. ]
  10. function App() {
  11. function radioChange(e) {
  12. e.target.value
  13. }
  14. return (
  15. <Form.Item label="时间">
  16. <Radio.Group
  17. value={1}
  18. onChange={radioChange}
  19. options={options}
  20. optionType="button"
  21. buttonStyle="solid"
  22. />
  23. </Form.Item>
  24. )
  25. }

Radio组件参考资料
https://ant-design.antgroup.com/components/radio-cn
https://3x.ant.design/components/radio-cn

日期联动

image.png

移动端日期场景

用户数据

  1. const today = []
  2. const yesterday = []

image.png