Browse Source
feat(table): 表格拖拽列改变宽度
* feat(funcation): update 修复表格无法拖拽列改变宽度
* feat(function): add 完善可伸缩列
---------
Co-authored-by: gavin-james <meaganlindesy1258@gmail.com>
pull/3071/head
林飞
3 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with
10 additions and
0 deletions
-
src/components/Table/src/BasicTable.vue
-
src/components/Table/src/hooks/useColumns.ts
|
|
|
@ -21,6 +21,7 @@ |
|
|
|
:rowClassName="getRowClassName" |
|
|
|
v-show="getEmptyDataIsShowTable" |
|
|
|
@change="handleTableChange" |
|
|
|
@resizeColumn="setColumnWidth" |
|
|
|
> |
|
|
|
<template #[item]="data" v-for="item in Object.keys($slots)" :key="item"> |
|
|
|
<slot :name="item" v-bind="data || {}"></slot> |
|
|
|
@ -189,6 +190,7 @@ |
|
|
|
getColumns, |
|
|
|
setCacheColumnsByField, |
|
|
|
setCacheColumns, |
|
|
|
setColumnWidth, |
|
|
|
setColumns, |
|
|
|
getColumnsRef, |
|
|
|
getCacheColumns, |
|
|
|
@ -345,6 +347,7 @@ |
|
|
|
handleSearchInfoChange, |
|
|
|
getEmptyDataIsShowTable, |
|
|
|
handleTableChange, |
|
|
|
setColumnWidth, |
|
|
|
getRowClassName, |
|
|
|
wrapRef, |
|
|
|
tableAction, |
|
|
|
|
|
|
|
@ -264,12 +264,19 @@ export function useColumns( |
|
|
|
if (!isArray(columns)) return; |
|
|
|
cacheColumns = columns.filter((item) => !item.flag); |
|
|
|
} |
|
|
|
/** |
|
|
|
* 拖拽列宽修改列的宽度 |
|
|
|
*/ |
|
|
|
function setColumnWidth(w: number, col: BasicColumn) { |
|
|
|
col.width = w; |
|
|
|
} |
|
|
|
|
|
|
|
return { |
|
|
|
getColumnsRef, |
|
|
|
getCacheColumns, |
|
|
|
getColumns, |
|
|
|
setColumns, |
|
|
|
setColumnWidth, |
|
|
|
getViewColumns, |
|
|
|
setCacheColumnsByField, |
|
|
|
setCacheColumns, |
|
|
|
|