🐛(table): 修复 scroll 在固定列时不固定的问题

This commit is contained in:
就眠儀式 2022-07-21 09:59:57 +08:00
parent 35118feb60
commit 826dc0fa75
4 changed files with 9 additions and 6 deletions

View File

@ -285,7 +285,7 @@ const renderFixedStyle = (column: any, columnIndex: number) => {
} }
return { left: `${left}px` } as StyleValue; return { left: `${left}px` } as StyleValue;
} else { } else {
var right = 0; var right = scrollWidthCell.value > 0 ? scrollWidthCell.value : 0;
for (var i = columnIndex + 1; i < props.columns.length; i++) { for (var i = columnIndex + 1; i < props.columns.length; i++) {
if (props.columns[i].fixed && props.columns[i].fixed == "right") { if (props.columns[i].fixed && props.columns[i].fixed == "right") {
right = right + props.columns[i]?.width.replace("px", ""); right = right + props.columns[i]?.width.replace("px", "");
@ -472,9 +472,12 @@ const renderTotalRowCell = (column: any) => {
</template> </template>
<th <th
v-if="scrollWidthCell > 0" v-if="scrollWidthCell > 0"
class="layui-table-fixed-right"
:style="{ :style="{
padding: 0, padding: 0,
width: `${scrollWidthCell}px`, width: `${scrollWidthCell}px`,
background: '#fafafa'
}" }"
></th> ></th>
</tr> </tr>

View File

@ -977,7 +977,7 @@ export default {
::: demo ::: demo
<template> <template>
<lay-table :columns="columns5" id="id" :expand-index="1" :data-source="dataSource5" v-model:selected-keys="selectedKeys5" :checkbox="checkbox5" :default-toolbar="defaultToolbar5" @row="rowClick5"> <lay-table :columns="columns5" id="id" :expand-index="1" :data-source="dataSource5" v-model:selected-keys="selectedKeys5" :checkbox="checkbox5" :default-toolbar="defaultToolbar5" @row="rowClick5" max-height="200px">
<template v-slot:toolbar> <template v-slot:toolbar>
<lay-button size="sm">新增</lay-button> <lay-button size="sm">新增</lay-button>
<lay-button size="sm">删除</lay-button> <lay-button size="sm">删除</lay-button>

View File

@ -14,7 +14,7 @@
<ul> <ul>
<a name="1-3-1"></a> <a name="1-3-1"></a>
<li> <li>
<h3>1.3.0 <span class="layui-badge-rim">2022-07-20</span></h3> <h3>1.3.1 <span class="layui-badge-rim">2022-07-20</span></h3>
<ul> <ul>
<li>[新增] input 组件 append 与 prepend 插槽。</li> <li>[新增] input 组件 append 与 prepend 插槽。</li>
<li>[新增] input 组件 password 属性, 开启密码模式。</li> <li>[新增] input 组件 password 属性, 开启密码模式。</li>

View File

@ -151,7 +151,7 @@
</lay-tooltip> </lay-tooltip>
</lay-col> </lay-col>
<lay-col :md="3"> <lay-col :md="3">
<lay-tooltip content="lite-flow" position="top"> <lay-tooltip content="LiteFlow" position="top">
<a <a
style="height: 40px; display: inline-block" style="height: 40px; display: inline-block"
href="https://liteflow.yomahub.com" href="https://liteflow.yomahub.com"
@ -165,7 +165,7 @@
</lay-tooltip> </lay-tooltip>
</lay-col> </lay-col>
<lay-col :md="3"> <lay-col :md="3">
<lay-tooltip content="cc-flow" position="top"> <lay-tooltip content="CCFlow" position="top">
<a <a
style="height: 40px; display: inline-block" style="height: 40px; display: inline-block"
href="http://ccflow.org/" href="http://ccflow.org/"
@ -179,7 +179,7 @@
</lay-tooltip> </lay-tooltip>
</lay-col> </lay-col>
<lay-col :md="3"> <lay-col :md="3">
<lay-tooltip content="pear-admin" position="top"> <lay-tooltip content="Pear Admin" position="top">
<a <a
style="height: 40px; display: inline-block" style="height: 40px; display: inline-block"
href="http://www.pearadmin.com" href="http://www.pearadmin.com"