Skip to content

Commit

Permalink
feat: 非固定层的固定列应设置为不可见状态
Browse files Browse the repository at this point in the history
  • Loading branch information
Robin-front committed Sep 29, 2019
1 parent 8ab2f3d commit e8bc119
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 3 deletions.
3 changes: 3 additions & 0 deletions src/css/main.less
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,9 @@
border-color: #ccc;
}
}
&-hidden{
visibility: hidden;
}
&-tip{
text-align: center;
}
Expand Down
8 changes: 7 additions & 1 deletion src/tableFoot.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,10 @@
<div class="flex-table-foot" :style="{ height: height }">
<div class="flex-table-row">
<div
class="flex-table-col"
:class="{
'flex-table-col': true,
'flex-table-hidden': isInvisible(item)
}"
v-for="(item, index) in columns"
:key="index"
:style="setCellStyle(item)"
Expand Down Expand Up @@ -79,6 +82,9 @@ export default {
},
shouldRender(item) {
return this.sum[item.key] !== undefined && !this.isHidden(item)
},
isInvisible(col) { // 非固定层的固定列应不可见
return col.fixed && !this.onlyFixed;
}
}
}
Expand Down
8 changes: 7 additions & 1 deletion src/tableHead.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,12 @@
<div class="flex-table-head" :style="{ height: height }">
<div class="flex-table-row">
<div
class="flex-table-col"
v-for="(item, index) in headRow"
:key="item.key + '_' + index"
:class="{
'flex-table-col': true,
'flex-table-hidden': isInvisible(item)
}"
:style="setCellStyle(item)"
>
<template v-if="!isHidden(item)">
Expand Down Expand Up @@ -138,6 +141,9 @@ export default {
},
isHidden(item) {
return this.onlyFixed && (item.fixed !== this.onlyFixed);
},
isInvisible(col) { // 非固定层的固定列应不可见
return col.fixed && !this.onlyFixed;
}
}
}
Expand Down
6 changes: 5 additions & 1 deletion src/tableTd.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
'flex-table-col': true,
'flex-table-col-icon': renderType === 'expand',
'flex-table-expand-disabled': renderType === 'expand' && row._disableExpand,
'flex-table-hidden': isInvisible
}"
:style="setCellStyle(column)"
@click="onToggleExpand"
Expand Down Expand Up @@ -84,8 +85,11 @@ export default {
}
},
computed: {
isHidden() {
isHidden() { // 固定层的非固定列无需渲染
return this.onlyFixed && (this.column.fixed !== this.onlyFixed);
},
isInvisible() { // 非固定层的固定列应不可见
return this.column.fixed && !this.onlyFixed;
}
},
created(){
Expand Down

0 comments on commit e8bc119

Please sign in to comment.