feat(table): 表格拖拽列改变宽度

* feat(funcation): update 修复表格无法拖拽列改变宽度

* feat(function): add 完善可伸缩列

---------

Co-authored-by: gavin-james <meaganlindesy1258@gmail.com>
This commit is contained in:
林飞 2023-09-22 10:35:30 +08:00 committed by GitHub
parent 5665fd62a9
commit 1cf2a81f2a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 0 deletions

View File

@ -21,6 +21,7 @@
:rowClassName="getRowClassName" :rowClassName="getRowClassName"
v-show="getEmptyDataIsShowTable" v-show="getEmptyDataIsShowTable"
@change="handleTableChange" @change="handleTableChange"
@resizeColumn="setColumnWidth"
> >
<template #[item]="data" v-for="item in Object.keys($slots)" :key="item"> <template #[item]="data" v-for="item in Object.keys($slots)" :key="item">
<slot :name="item" v-bind="data || {}"></slot> <slot :name="item" v-bind="data || {}"></slot>
@ -189,6 +190,7 @@
getColumns, getColumns,
setCacheColumnsByField, setCacheColumnsByField,
setCacheColumns, setCacheColumns,
setColumnWidth,
setColumns, setColumns,
getColumnsRef, getColumnsRef,
getCacheColumns, getCacheColumns,
@ -345,6 +347,7 @@
handleSearchInfoChange, handleSearchInfoChange,
getEmptyDataIsShowTable, getEmptyDataIsShowTable,
handleTableChange, handleTableChange,
setColumnWidth,
getRowClassName, getRowClassName,
wrapRef, wrapRef,
tableAction, tableAction,

View File

@ -264,12 +264,19 @@ export function useColumns(
if (!isArray(columns)) return; if (!isArray(columns)) return;
cacheColumns = columns.filter((item) => !item.flag); cacheColumns = columns.filter((item) => !item.flag);
} }
/**
*
*/
function setColumnWidth(w: number, col: BasicColumn) {
col.width = w;
}
return { return {
getColumnsRef, getColumnsRef,
getCacheColumns, getCacheColumns,
getColumns, getColumns,
setColumns, setColumns,
setColumnWidth,
getViewColumns, getViewColumns,
setCacheColumnsByField, setCacheColumnsByField,
setCacheColumns, setCacheColumns,