Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
D
dcxy-manage-shell
Project
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
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
姜雷
dcxy-manage-shell
Commits
5519c273
Commit
5519c273
authored
Apr 28, 2019
by
姜雷
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改分离组件store
parent
6ec36260
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
26 additions
and
7 deletions
+26
-7
mixin.js
src/components/input/AreaDashboard/mixin.js
+17
-4
store.js
src/components/input/AreaDashboard/store.js
+9
-3
No files found.
src/components/input/AreaDashboard/mixin.js
View file @
5519c273
import
{
mapGetters
,
mapActions
}
from
'vuex'
;
import
store
from
'./store'
;
export
default
{
...
...
@@ -7,8 +6,13 @@ export default {
type
:
Number
,
},
},
data
()
{
return
{
storeIndex
:
0
,
};
},
created
()
{
store
.
install
(
this
.
$store
);
this
.
storeIndex
=
store
.
install
(
this
.
$store
);
},
mounted
()
{
if
(
this
.
dashboardArea
&&
!
this
.
dashboardArea
.
length
)
{
...
...
@@ -25,10 +29,19 @@ export default {
},
},
computed
:
{
...
mapGetters
(
'dashboardArea'
,
[
'dashboardArea'
]),
dashboardArea
()
{
return
this
.
$store
.
getters
[
`dashboardArea
${
this
.
storeIndex
}
/dashboardArea`
];
},
},
methods
:
{
...
mapActions
(
'dashboardArea'
,
[
'fetchDashboardAreaList'
]),
fetchDashboardAreaList
(
entity
)
{
return
this
.
$store
.
dispatch
(
`dashboardArea
${
this
.
storeIndex
}
/fetchDashboardAreaList`
,
entity
);
},
getAreaName
(
id
)
{
let
item
=
this
.
dashboardArea
.
find
(
area
=>
area
.
id
===
id
);
if
(
item
)
{
...
...
src/components/input/AreaDashboard/store.js
View file @
5519c273
import
areaStroe
from
'./areaStore'
;
let
index
=
0
;
export
default
{
install
(
store
)
{
if
(
!
store
.
state
.
base
)
{
...
...
@@ -7,11 +9,15 @@ export default {
state
:
{},
});
}
if
(
!
store
.
state
.
base
.
dashboardArea
)
{
store
.
registerModule
([
'base'
,
'dashboardArea'
],
areaStroe
);
if
(
!
store
.
state
.
base
[
'dashboardArea'
+
index
])
{
store
.
registerModule
([
'base'
,
'dashboardArea'
+
index
],
areaStroe
);
}
else
{
index
++
;
store
.
registerModule
([
'base'
,
'dashboardArea'
+
index
],
areaStroe
);
}
return
index
;
},
uninstall
(
store
)
{
store
.
unregisterModule
([
'base'
,
'dashboardArea'
]);
store
.
unregisterModule
([
'base'
,
'dashboardArea'
+
index
]);
},
};
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