我们都知道表格是横向渲染的,一行一行去展示。不过博主这里有个需求是纵向渲染,一列一列去展示…嗯[思考]…做出来了,下面是全部代码,可拿过去自行取用。
纵向渲染表格
添加一列
type="primary"
v-if="isAdd"
icon="el-icon-plus"
size="mini"
v-hasPermi="['manager:trader:add']"
@click="tableAdd"
:disabled="is10"
>添加
>
type="primary"
@click="dataSave"
v-else
size="mini"
:disabled="nonum"
v-hasPermi="['manager:trader:edit']"
>{{isSave ? "保存":"取消"}}
>
width="100px"
prop="tableName"
align="center"
label="星期"
>
{{ tableData[scope.$index].name }}
align="center"
v-for="(item, index) in headerData.length"
:key="index"
>
{{ tableData[scope.$index].data[index]}}
{{ headerData[$index-1] }}
align="center"
v-for="(item, index) in tableAdds"
:key="index + Date()"
>
{{ newTime }}
// 给表头加斜线的css
::v-deep .el-table th {
overflow: initial;
}
::v-deep .el-table .el-table__header-wrapper th {
height: 30px !important;
}
::v-deep .el-table--medium th {
padding: 0 !important;
}
::v-deep .el-table thead tr:first-of-type th:first-of-type,
::v-deep .el-table thead tr:nth-of-type(2) th:first-of-type {
border-bottom: none;
}
::v-deep .el-table thead tr:first-of-type th:first-of-type .cell {
text-align: right;
}
::v-deep .el-table thead tr:nth-of-type(2) th:first-of-type .cell {
padding-left: 0;
position: absolute;
top: 12px;
left: 16px;
z-index: 99;
}
::v-deep .el-table thead tr:last-of-type th:first-of-type .cell {
text-align: left;
}
::v-deep .el-table thead tr:first-of-type th:first-of-type:before,
::v-deep .el-table thead tr:last-of-type th:first-of-type:before {
content: "";
position: absolute;
width: 1px;
background-color: #dfe6ec;
display: block;
}
::v-deep .el-table thead tr:first-of-type th:first-of-type:before {
height: 198px; //根据情况调整
top: 0;
left: 0; //根据情况调整
transform: rotate(-32deg); //根据情况调整
transform-origin: top;
z-index: 2;
}
::v-deep .el-table thead tr:last-of-type th:first-of-type:before {
height: 112px; //根据情况调整
top: -60px;
left: 0; //根据情况调整
transform: rotate(-62deg); //根据情况调整
transform-origin: top;
z-index: 2;
}
::v-deep .el-input{
width: 90%;
.el-input__decrease,.el-input__increase{
background: #FFFFFF;
}
}
| 留言与评论(共有 0 条评论) “” |