123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179 |
- /*
- * uni-app 表格样式表
- * 作者:helang
- * 邮箱:helang.love@qq.com
- */
- .h-table{
- .left-width{
- width: 160rpx !important;
- }
- /* 行 */
- .h-tr{
- box-sizing: border-box;
- display: flex;
- flex-direction: row;
- flex-wrap: nowrap;
- justify-content: flex-start;
- align-items: stretch;
- align-content: center;
-
- border-color: #ccc;
- border-style: solid;
- border-width: 0;
- border-top-width: 1px;
- border-left-width: 1px;
- border-bottom-width: 1px;
- color: #333;
-
- /* 等比分列,1-10列 */
- @for $i from 1 through 10
- {
- &-#{$i}{
- >.h-td{
- width:(100% / $i);
- }
- }
- }
-
- + .h-tr{
- border-top-style: none;
- }
- }
- /* 单元格 */
- .h-td{
- box-sizing: border-box;
- padding: 3px;
- word-break:break-all;
- border-color: #ccc;
- border-style: solid;
- border-width: 0;
- border-right-width: 1px;
- display: flex;
- flex-direction: row;
- flex-wrap: nowrap;
- justify-content: center;
- align-items: center;
- align-content: center;
- min-height: 30rpx;
-
- /* 跨列 */
- &-colspan{
- flex-grow: 1;
- width:0;
- }
-
- &-rowspan{
- // border: none;
- border-right-width: 0;
- padding: 0 !important;
- flex-wrap: wrap !important;
-
- >.h-tr{
- width: 100%;
- border-width: 0;
-
- .h-td{
- border-right-width: 1px;
- }
-
- & + .h-tr{
- border-top-width: 1px;
- border-top-style: solid;
- }
- }
- }
-
- /* 内容顶部对齐 */
- &-top{
- align-items: flex-start;
- align-content:flex-start;
- }
- /* 内容底部对齐 */
- &-bottom{
- align-items: flex-end;
- align-content:flex-end;
- }
- /* 内容左边对齐 */
- &-left{
- justify-content: flex-start;
- }
- /* 内容右边对齐 */
- &-right{
- justify-content: flex-end;
- }
- }
- /* 表头 */
- .h-thead{
- background-color: #e6e6e6;
- }
-
- /* 表格虚线 */
- &-dashed{
- .h-tr{
- border-top-style: dashed;
- border-left-style: dashed;
- border-bottom-style: dashed;
- }
- .h-td{
- border-right-style: dashed;
- }
-
- .h-td-rowspan{
- .h-tr + .h-tr{
- border-top-style: dashed;
- }
- }
- }
-
- /* 表格主题 Map,颜色摘自 Bootstrap */
- $theme-table:(
- primary:(
- color:#fff,
- bgColor:#337ab7,
- border:#2e6da4
- ),
- success:(
- color:#fff,
- bgColor:#5cb85c,
- border:#4cae4c
- ),
- info:(
- color:#fff,
- bgColor:#5bc0de,
- border:#46b8da
- ),
- warning:(
- color:#fff,
- bgColor:#f0ad4e,
- border:#eea236
- ),
- danger:(
- color:#fff,
- bgColor:#d9534f,
- border:#d43f3a
- )
- );
-
- /* 生成主题代码 */
- $theme-table-keys:map-keys($theme-table);
- @each $k in $theme-table-keys {
- $item:map-get($theme-table,$k);
- &-#{$k}{
- .h-tr{
- border-top-color: map-get($item,border);
- border-left-color: map-get($item,border);
- border-bottom-color: map-get($item,border);
- color: map-get($item,bgColor);
- }
- .h-td{
- border-right-color: map-get($item,border);
-
- }
- .h-thead{
- background-color: map-get($item,bgColor);
- color: map-get($item,color);
- }
- }
- }
- }
|