Skip to content

Commit

Permalink
Merge pull request #921 from WeBankFinTech/fix-table-scrollbar
Browse files Browse the repository at this point in the history
fix(Table): 修复左侧列固定的时候,没有滚动条的时候,右侧也会出现阴影的问题
  • Loading branch information
zym19960704 authored Dec 27, 2024
2 parents 5b7aec4 + 9881308 commit ff3f979
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
11 changes: 10 additions & 1 deletion components/table/useTableStyle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,16 @@ export default ({
});

const scrollState = reactive({
x: 'left',
x: '', // 默认为空值,避免左侧列固定的时候,右侧默认出现阴影区域
});

watch(computed(() => scrollbarRef.value?.containerRef), () => {
// 有滚动条实例,说明实际内容宽度超出容器宽度,需要默认显示阴影区域
if (!scrollState.x && scrollbarRef.value?.containerRef) {
scrollState.x = 'left';
} else if (scrollState.x && !scrollbarRef.value?.containerRef) {
scrollState.x = '';
}
});

const headerWrapperClass = computed(() => {
Expand Down
6 changes: 3 additions & 3 deletions docs/.vitepress/components/table/bordered.vue
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,9 @@
:verticalLine="verticalLine"
:data="data"
>
<FTableColumn prop="date" label="日期" />
<FTableColumn prop="name" label="姓名" />
<FTableColumn prop="address" label="地址" />
<FTableColumn prop="date" label="日期" fixed :minWidth="100" />
<FTableColumn prop="name" label="姓名" :minWidth="100" />
<FTableColumn prop="address" label="地址" :minWidth="100" />
</FTable>
</template>

Expand Down

0 comments on commit ff3f979

Please sign in to comment.