React 组件实现表格一行显示 6 个选项 - 专项测试选择
import React, { ForwardedRef, forwardRef, useImperativeHandle, useRef, useState } from 'react'; import ContentCard from '@/components/ContentCard'; import './index.less'; import FixedWidthProForm from '@/components/FixedWidthProForm'; import { ProFormInstance } from '@ant-design/pro-form'; import { Checkbox } from 'antd'; import type { CheckboxValueType } from 'antd/es/checkbox/Group';
export type ApplicationFormRef = {
getApplicationFormValue?: () => any;
validateApplicationForm: () => Promise
const sepcialData = [ { label: '讯飞语音测试', value: '1', }, { label: '安全专项测试', value: '2', }, { label: '蓝牙功能测试', value: '3', }, { label: 'WIFI功能测试', value: '4', }, { label: '性能测试', value: '5', }, { label: 'HDMI兼容性测试', value: '6', }, { label: 'Google ART测试', value: '7', }, { label: 'GDPR专项测试', value: '8', }, { label: '蓝牙性能测试', value: '9', }, { label: 'WIFI性能测试', value: '10', }, { label: '流畅度测试', value: '11', }, { label: 'USB兼容性测试', value: '12', }, { label: 'Amazon ART测试', value: '13', }, { label: 'CAPP专项测试', value: '14', }, { label: '蓝牙兼容性测试', value: '15', }, { label: 'WIFI兼容性测试', value: '16', }, ];
const SpecialTest: React.FC
const onChange = (checkedValues: CheckboxValueType[]) => { console.log(checkedValues, 92); setCheckValue(checkedValues); };
return (
export default SpecialTest; .table-container { display: flex; flex-wrap: wrap; /* 设置为wrap,可以换行显示 */ width: 100%; }
.table-cell { flex-basis: calc(16.66% - 20px); /* 每列占据的宽度,减去20px是为了给每个选项添加一些间距 */ padding: 10px; box-sizing: border-box; border: none; box-shadow: 0 0 0 0.5px #ddd; }
/* 以下为实现表格一行显示 6 个选项的 CSS 代码 / .table-container { display: flex; flex-wrap: wrap; / 设置为wrap,可以换行显示 */ width: 100%; }
.table-cell { flex-basis: calc(16.66% - 20px); /* 每列占据的宽度,减去20px是为了给每个选项添加一些间距 */ padding: 10px; box-sizing: border-box; border: none; box-shadow: 0 0 0 0.5px #ddd; }
原文地址: https://www.cveoy.top/t/topic/qlJT 著作权归作者所有。请勿转载和采集!