Skip to content

Commit

Permalink
perf: 表格布局时优化组件联动隐藏边框线1px问题 @0.8.8-5
Browse files Browse the repository at this point in the history
  • Loading branch information
BoBoooooo committed Mar 1, 2021
1 parent 17fa57b commit 59937b4
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "element-pro-crud",
"version": "0.8.8-4",
"version": "0.8.8-5",
"author": "BoBo<[email protected]>",
"main": "lib/ProCrud.umd.min.js",
"files": [
Expand Down
14 changes: 13 additions & 1 deletion src/component/form-designer/src/GenerateForm.vue
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,10 @@
<!-- 生成每一行中的每一列元素 -->
<el-col v-for="(col, colIndex) in item.columns"
:key="colIndex"
:span="col.span">
:span="col.span"
:style="{
'border': isNoBorder(col,item) ? 'none!important':'unset'
}">>
<!-- 遍历生成该列所有组件 -->
<template v-for="citem in col.list">
<!-- 如果一个元素的type是blank就加载插槽 -->
Expand Down Expand Up @@ -173,6 +176,12 @@ export default class GenerateForm extends Vue {
}
}

// 若为表格布局并且当前栅格内只有一个元素并且为隐藏状态,隐藏边框线
isNoBorder(col, item) {
const { list } = col;
return this.data.config && this.data.config.isTableClass && list.every(_ => _.hidden) && item.columns.length === 1;
}

// 组件联动handler
controlFieldHandler(model) {
this.rules.forEach((r) => {
Expand Down Expand Up @@ -418,4 +427,7 @@ export default class GenerateForm extends Vue {
top: 30px;
z-index: 2;
}
.no-border{
border:none!important;
}
</style>

0 comments on commit 59937b4

Please sign in to comment.