fix: GrTable 移动端去除 fixed 方向 (主列+操作列不再 fixed)

This commit is contained in:
guoju0808
2026-08-26 11:34:32 +00:00
parent 0644e26120
commit 4de6479be0
+8
View File
@@ -47,6 +47,7 @@
<component <component
:is="child" :is="child"
v-if="shouldRenderColumn(child, idx)" v-if="shouldRenderColumn(child, idx)"
:fixed="resolveFixed(child)"
/> />
</template> </template>
</el-table> </el-table>
@@ -143,6 +144,13 @@ function shouldRenderColumn(node, idx) {
return mainColsResolved.value.includes(meta.prop) // 只渲染主列 return mainColsResolved.value.includes(meta.prop) // 只渲染主列
} }
// 移动端移除 fixed 方向 (桌面仍保留 fixed-left/right 横滚体验)
function resolveFixed(node) {
if (!isMobile.value) return node.props?.fixed
// 移动端: el-table 在窄屏基本只剩 3-5 列, 不再需要列固定 (会撑出滚动容器)
return undefined
}
// 透传 el-table 引用方法 (clearSelection / toggleRowSelection 等) // 透传 el-table 引用方法 (clearSelection / toggleRowSelection 等)
defineExpose({ defineExpose({
clearSelection: (...args) => tableRef.value?.clearSelection?.(...args), clearSelection: (...args) => tableRef.value?.clearSelection?.(...args),