因为表格的圆角实现比较复杂,写个less函数记录下使用@import(reference)'./utils.less';table{//为不同的顶点设置统一的圆角.add-radius-for-table(@border:1pxsolid#000;@allRadius:6px);//可以为不同的顶点设置不同的圆角。add-radius-for-table(@border:1pxsolid#000;@allRadius:6px7px8px9px);}toolfunctionutils.less/***@description:设置表格表格的圆角边框*@paramborder:表格的边框样式:1pxsolidblue*@paramallRadius:表格的半径:5pxor5px10pxor5px10px20pxetc*/.add-radius-for-table(@border,@allRadius){.getFullStrFromNum(@allRadius);@leftTop:提取物(@res,1);@rightTop:提取物(@res,2);@rightBottom:提取物(@res,3);@leftBottom:提取物(@res,4);边界折叠:分开;边框间距:0px;tr{td,th{边框:@border;:没有任何;左边框:无;&:first-child{border-left:@border;}}&:first-child{td,th{border-top:@border;&:first-child{border-top-left-radius:@leftTop;}&:last-child{border-top-right-radius:@rightTop;}}}&:last-child{td,th{&:first-child{border-bottom-left-radius:@leftBottom;}&:last-child{border-bottom-right-radius:@rightBottom;}}}}}/***@description:将5px10px类型的数组参数补充为四位5px10px5px10px;为了以后取参数方便*@paramall:5pxor5px10pxor5px10px20pxetc.*/.getFullStrFromNum(@all){._getFullStrFromNum(@all){@res:@all;}._getFullStrFromNum(@all)when(length(@all)=1){@res:@all@all@all@all;}._getFullStrFromNum(@all)when(length(@all)=2){@res:提取物(@all,1)提取物(@all,2)提取物(@all,1)提取物(@all,2);}._getFullStrFromNum(@all)when(length(@all)=3){@res:提取物(@all,1)提取物(@all,2)提取物(@all,3)提取物(@all,2);}._getFullStrFromNum(@all);}
