Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
N
najiu-admin-template
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
najiu-frontend
najiu-admin-template
Commits
af55511b
Commit
af55511b
authored
Jan 02, 2021
by
vben
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix(table): table columns setting error
parent
aa596af6
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
32 additions
and
12 deletions
+32
-12
CHANGELOG.zh_CN.md
CHANGELOG.zh_CN.md
+4
-0
useColumns.ts
src/components/Table/src/hooks/useColumns.ts
+17
-6
useTable.ts
src/components/Table/src/hooks/useTable.ts
+11
-6
No files found.
CHANGELOG.zh_CN.md
View file @
af55511b
...
@@ -4,6 +4,10 @@
...
@@ -4,6 +4,10 @@
-
新增
`mixSideTrigger`
配置。用于配置左侧混合模式菜单打开方式。可选
`hover`
,默认
`click`
-
新增
`mixSideTrigger`
配置。用于配置左侧混合模式菜单打开方式。可选
`hover`
,默认
`click`
### 🐛 Bug Fixes
-
修复表格列配置已知问题
## 2.0.0-rc.15 (2020-12-31)
## 2.0.0-rc.15 (2020-12-31)
### ✨ 表格破坏性更新
### ✨ 表格破坏性更新
...
...
src/components/Table/src/hooks/useColumns.ts
View file @
af55511b
import
type
{
BasicColumn
,
BasicTableProps
,
CellFormat
,
GetColumnsParams
}
from
'
../types/table
'
;
import
type
{
BasicColumn
,
BasicTableProps
,
CellFormat
,
GetColumnsParams
}
from
'
../types/table
'
;
import
type
{
PaginationProps
}
from
'
../types/pagination
'
;
import
type
{
PaginationProps
}
from
'
../types/pagination
'
;
import
{
unref
,
ComputedRef
,
Ref
,
computed
,
watch
Effect
,
ref
,
toRaw
}
from
'
vue
'
;
import
{
unref
,
ComputedRef
,
Ref
,
computed
,
watch
,
ref
,
toRaw
}
from
'
vue
'
;
import
{
isBoolean
,
isArray
,
isString
,
isObject
}
from
'
/@/utils/is
'
;
import
{
isBoolean
,
isArray
,
isString
,
isObject
}
from
'
/@/utils/is
'
;
import
{
DEFAULT_ALIGN
,
PAGE_SIZE
,
INDEX_COLUMN_FLAG
,
ACTION_COLUMN_FLAG
}
from
'
../const
'
;
import
{
DEFAULT_ALIGN
,
PAGE_SIZE
,
INDEX_COLUMN_FLAG
,
ACTION_COLUMN_FLAG
}
from
'
../const
'
;
import
{
useI18n
}
from
'
/@/hooks/web/useI18n
'
;
import
{
useI18n
}
from
'
/@/hooks/web/useI18n
'
;
...
@@ -156,11 +156,22 @@ export function useColumns(
...
@@ -156,11 +156,22 @@ export function useColumns(
return
viewColumns
;
return
viewColumns
;
});
});
watchEffect
(()
=>
{
watch
(
const
columns
=
toRaw
(
unref
(
propsRef
).
columns
);
()
=>
unref
(
propsRef
).
columns
,
columnsRef
.
value
=
columns
;
(
columns
)
=>
{
cacheColumns
=
columns
?.
filter
((
item
)
=>
!
item
.
flag
)
??
[];
columnsRef
.
value
=
columns
;
});
cacheColumns
=
columns
?.
filter
((
item
)
=>
!
item
.
flag
)
??
[];
}
);
// watchEffect(() => {
// const columns = toRaw(unref(propsRef).columns);
// console.log('======================');
// console.log(111);
// console.log('======================');
// columnsRef.value = columns;
// cacheColumns = columns?.filter((item) => !item.flag) ?? [];
// });
/**
/**
* set columns
* set columns
...
...
src/components/Table/src/hooks/useTable.ts
View file @
af55511b
...
@@ -3,11 +3,10 @@ import type { PaginationProps } from '../types/pagination';
...
@@ -3,11 +3,10 @@ import type { PaginationProps } from '../types/pagination';
import
type
{
DynamicProps
}
from
'
/@/types/utils
'
;
import
type
{
DynamicProps
}
from
'
/@/types/utils
'
;
import
{
getDynamicProps
}
from
'
/@/utils
'
;
import
{
getDynamicProps
}
from
'
/@/utils
'
;
import
{
ref
,
onUnmounted
,
unref
}
from
'
vue
'
;
import
{
ref
,
onUnmounted
,
unref
,
watch
}
from
'
vue
'
;
import
{
isProdMode
}
from
'
/@/utils/env
'
;
import
{
isProdMode
}
from
'
/@/utils/env
'
;
import
{
isInSetup
}
from
'
/@/utils/helper/vueHelper
'
;
import
{
isInSetup
}
from
'
/@/utils/helper/vueHelper
'
;
import
{
error
}
from
'
/@/utils/log
'
;
import
{
error
}
from
'
/@/utils/log
'
;
import
{
watchEffect
}
from
'
vue
'
;
import
type
{
FormActionType
}
from
'
/@/components/Form
'
;
import
type
{
FormActionType
}
from
'
/@/components/Form
'
;
type
Props
=
Partial
<
DynamicProps
<
BasicTableProps
>>
;
type
Props
=
Partial
<
DynamicProps
<
BasicTableProps
>>
;
...
@@ -33,12 +32,18 @@ export function useTable(
...
@@ -33,12 +32,18 @@ export function useTable(
}
}
tableRef
.
value
=
instance
;
tableRef
.
value
=
instance
;
formRef
.
value
=
formInstance
;
formRef
.
value
=
formInstance
;
// tableProps && instance.setProps(tableProps
);
tableProps
&&
instance
.
setProps
(
getDynamicProps
(
tableProps
)
);
loadedRef
.
value
=
true
;
loadedRef
.
value
=
true
;
watchEffect
(()
=>
{
watch
(
tableProps
&&
instance
.
setProps
(
getDynamicProps
(
tableProps
));
()
=>
tableProps
,
});
()
=>
{
tableProps
&&
instance
.
setProps
(
getDynamicProps
(
tableProps
));
},
{
immediate
:
true
,
}
);
}
}
function
getTableInstance
():
TableActionType
{
function
getTableInstance
():
TableActionType
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment