iView常见全局样式

记录常用的全局样式写法

手动在form-item前加上红色*,表示必填项

1
2
3
4
5
6
7
8
9
.ivu-form-item-required .ivu-form-item-label::before {
content: '*';
display: inline-block;
margin-right: 4px;
line-height: 1;
font-family: SimSun;
font-size: 12px;
color: #ed3f14;
}

form-item上定义类ivu-form-item-required

多余文字省略

1
2
3
4
5
.text-overflow {
text-overflow: ellipsis;
overflow: hidden;
white-space: nowrap;
}

表格行高

1
2
3
4
/*表格高度改为35ps*/
.ivu-table td {
height: 35px;
}

表格无数据时的默认图片

1
2
3
4
5
6
7
8
9
10
11
/* 表格没有数据时的默认图片 */
.ivu-table-tip table td span {
background: url("../../assets/images/tableDataEmpty.png");
padding-bottom: 50px;
display: inline-block;
padding-top: 160px;
color: #aaaaaa;
background-repeat: no-repeat;
background-position: center 40px;
min-width: 200px;
}

表格表头

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
/*表格表头*/
table th .ivu-table-cell {
position: relative;
display: block;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
padding-left: 10px;
padding-right: 10px;
span {
margin-top: -2px;
}
.ivu-table-sort {
margin-top: -6px;
position: absolute;
top: 50%;
right: 5px;
}
}

表格公共样式

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
//表格公共样式
.tableInfoBox {
position: relative;
margin: 10px 0px 0px;
.baseBorder();
background-color: #fff;
.ivu-table-wrapper {
border: 0px;
}
.ivu-table-border th,
.ivu-table-border td {
border-color: @baseBorderColor;
}
.ivu-table-border th:last-child,
.ivu-table-border td:last-child {
border-right: 0px;
}
.ivu-table:after {
width: 0px;
}
.ivu-table:before {
height: 0px;
}
.ivu-table table {
width: calc(~'100% - '0px) !important;
}
.ivu-table-tip td {
border-bottom: 0px;
span {
width: 100%;
padding: 0px;
background: url("../../assets/images/tableNoneData.png");
display: inline-block;
color: #aaaaaa;
background-repeat: no-repeat;
background-position: center 50%;
}
}
.webPage {
position: absolute;
bottom: 0px;
left: 0px;
right: 0px;
height: 70px;
text-align: center;
padding: 18px 0px;
background: #fff;
}
&.hasDataAndPage {
padding-bottom: 70px;
}
}

弹窗居中显示

1
2
3
4
5
6
7
8
9
/*-弹窗居中显示-*/
.vertical-center-modal {
display: flex;
align-items: center;
justify-content: center;
.ivu-modal {
top: 0;
}
}

不可点击

1
2
3
4
.look {
pointer-events: none;
outline: none;
}

注意input还需加readonly,否则双击还是可编辑

form-item框和字变红

1
2
3
4
5
6
7
8
9
10
11
.red {
.ivu-input.ivu-input-default {
color: red;
}
.ivu-select.ivu-select-single.ivu-select-default {
color: red;
}
.ivu-form-item-label {
color: red;
}
}