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
d81481c5
Commit
d81481c5
authored
Jun 06, 2021
by
Vben
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix(table): try to get close to the form stuck
parent
19d8e01e
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
14 deletions
+20
-14
useTable.ts
src/components/Table/src/hooks/useTable.ts
+20
-14
No files found.
src/components/Table/src/hooks/useTable.ts
View file @
d81481c5
...
@@ -2,10 +2,16 @@ import type { BasicTableProps, TableActionType, FetchParams, BasicColumn } from
...
@@ -2,10 +2,16 @@ import type { BasicTableProps, TableActionType, FetchParams, BasicColumn } from
import
type
{
PaginationProps
}
from
'
../types/pagination
'
;
import
type
{
PaginationProps
}
from
'
../types/pagination
'
;
import
type
{
DynamicProps
}
from
'
/#/utils
'
;
import
type
{
DynamicProps
}
from
'
/#/utils
'
;
import
type
{
FormActionType
}
from
'
/@/components/Form
'
;
import
type
{
FormActionType
}
from
'
/@/components/Form
'
;
import
type
{
WatchStopHandle
}
from
'
vue
'
;
//
import type { WatchStopHandle } from 'vue';
import
{
getDynamicProps
}
from
'
/@/utils
'
;
import
{
getDynamicProps
}
from
'
/@/utils
'
;
import
{
ref
,
onUnmounted
,
unref
,
watch
,
toRaw
}
from
'
vue
'
;
import
{
ref
,
onUnmounted
,
unref
,
// watch,
toRaw
,
}
from
'
vue
'
;
import
{
isProdMode
}
from
'
/@/utils/env
'
;
import
{
isProdMode
}
from
'
/@/utils/env
'
;
import
{
error
}
from
'
/@/utils/log
'
;
import
{
error
}
from
'
/@/utils/log
'
;
...
@@ -25,7 +31,7 @@ export function useTable(tableProps?: Props): [
...
@@ -25,7 +31,7 @@ export function useTable(tableProps?: Props): [
const
loadedRef
=
ref
<
Nullable
<
boolean
>>
(
false
);
const
loadedRef
=
ref
<
Nullable
<
boolean
>>
(
false
);
const
formRef
=
ref
<
Nullable
<
UseTableMethod
>>
(
null
);
const
formRef
=
ref
<
Nullable
<
UseTableMethod
>>
(
null
);
let
stopWatch
:
WatchStopHandle
;
//
let stopWatch: WatchStopHandle;
function
register
(
instance
:
TableActionType
,
formInstance
:
UseTableMethod
)
{
function
register
(
instance
:
TableActionType
,
formInstance
:
UseTableMethod
)
{
isProdMode
()
&&
isProdMode
()
&&
...
@@ -41,18 +47,18 @@ export function useTable(tableProps?: Props): [
...
@@ -41,18 +47,18 @@ export function useTable(tableProps?: Props): [
tableProps
&&
instance
.
setProps
(
getDynamicProps
(
tableProps
));
tableProps
&&
instance
.
setProps
(
getDynamicProps
(
tableProps
));
loadedRef
.
value
=
true
;
loadedRef
.
value
=
true
;
stopWatch
?.();
//
stopWatch?.();
stopWatch
=
watch
(
//
stopWatch = watch(
()
=>
tableProps
,
//
() => tableProps,
()
=>
{
//
() => {
tableProps
&&
instance
.
setProps
(
getDynamicProps
(
tableProps
));
//
tableProps && instance.setProps(getDynamicProps(tableProps));
},
//
},
{
//
{
immediate
:
true
,
//
immediate: true,
deep
:
true
,
//
deep: 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