Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
F
front-backend
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
framework
front-backend
Commits
c6ebb071
Commit
c6ebb071
authored
Mar 08, 2020
by
Elune
Browse files
Options
Browse Files
Download
Plain Diff
🐛
merge moxun1639:2.5dev
解决组件实例与crud,及其中page、pagination、form未进行绑定关联
parents
157de350
314bc7b7
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
30 additions
and
9 deletions
+30
-9
src/components/Crud/crud.js
+30
-9
No files found.
src/components/Crud/crud.js
View file @
c6ebb071
...
...
@@ -597,6 +597,12 @@ function presenter(crud) {
console
.
warn
(
'[CRUD warn]: '
+
'please use $options.cruds() { return CRUD(...) or [CRUD(...), ...] }'
)
}
return
{
data
()
{
// 在data中返回crud,是为了将crud与当前实例关联,组件观测crud相关属性变化
return
{
crud
:
this
.
crud
}
},
beforeCreate
()
{
this
.
$crud
=
this
.
$crud
||
{}
let
cruds
=
this
.
$options
.
cruds
instanceof
Function
?
this
.
$options
.
cruds
()
:
crud
...
...
@@ -610,12 +616,7 @@ function presenter(crud) {
this
.
$crud
[
ele
.
tag
]
=
ele
ele
.
registerVM
(
'presenter'
,
this
,
0
)
})
this
.
crud
=
this
.
$crud
[
'defalut'
]
||
cruds
.
length
>
0
?
cruds
[
0
]
:
null
},
data
()
{
return
{
searchToggle
:
true
}
this
.
crud
=
this
.
$crud
[
'defalut'
]
||
cruds
[
0
]
},
methods
:
{
parseTime
...
...
@@ -657,9 +658,14 @@ function presenter(crud) {
*/
function
header
()
{
return
{
data
()
{
return
{
crud
:
this
.
crud
,
query
:
this
.
crud
.
query
}
},
beforeCreate
()
{
this
.
crud
=
lookupCrud
(
this
)
this
.
query
=
this
.
crud
.
query
this
.
crud
.
registerVM
(
'header'
,
this
,
1
)
},
destroyed
()
{
...
...
@@ -673,9 +679,14 @@ function header() {
*/
function
pagination
()
{
return
{
data
()
{
return
{
crud
:
this
.
crud
,
page
:
this
.
crud
.
page
}
},
beforeCreate
()
{
this
.
crud
=
lookupCrud
(
this
)
this
.
page
=
this
.
crud
.
page
this
.
crud
.
registerVM
(
'pagination'
,
this
,
2
)
},
destroyed
()
{
...
...
@@ -689,9 +700,14 @@ function pagination() {
*/
function
form
(
defaultForm
)
{
return
{
data
()
{
return
{
crud
:
this
.
crud
,
form
:
this
.
crud
.
form
}
},
beforeCreate
()
{
this
.
crud
=
lookupCrud
(
this
)
this
.
form
=
this
.
crud
.
form
this
.
crud
.
registerVM
(
'form'
,
this
,
3
)
},
created
()
{
...
...
@@ -713,6 +729,11 @@ function crud(options = {}) {
}
options
=
mergeOptions
(
defaultOptions
,
options
)
return
{
data
()
{
return
{
crud
:
this
.
crud
}
},
beforeCreate
()
{
this
.
crud
=
lookupCrud
(
this
)
this
.
crud
.
registerVM
(
options
.
type
,
this
)
...
...
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