Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
C
CivWeb
Project
Project
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
ReactWeb5
CivWeb
Commits
03b9d08f
Commit
03b9d08f
authored
Mar 07, 2022
by
崔佳豪
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: 重复初始化应用共享状态导致状态错乱问题
parent
79238d23
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
9 deletions
+14
-9
actions.js
src/actions.js
+12
-0
micro.js
src/micro.js
+2
-9
No files found.
src/actions.js
0 → 100644
View file @
03b9d08f
// 主应用 和 子应用数据传递
import
{
initGlobalState
}
from
'qiankun'
;
export
const
initialState
=
{
globalConfig
:
{},
};
const
actions
=
initGlobalState
(
initialState
);
// action.setGlobalState({key: value}) 更新状态
// actions.onGlobalStateChange((newState, prevStaet) => {}) 监听状态
export
default
actions
;
src/micro.js
View file @
03b9d08f
...
...
@@ -3,7 +3,6 @@ import 'kit_logger';
import
_
from
'lodash'
;
import
{
addGlobalUncaughtErrorHandler
,
initGlobalState
,
registerMicroApps
,
runAfterFirstMounted
,
setDefaultMountApp
,
...
...
@@ -17,6 +16,7 @@ import { actionCreators } from './containers/App/store';
import
{
FILTER_FOLER_REG
}
from
'./utils/constants'
;
import
loader
from
'./render'
;
import
store
from
'./stores'
;
import
actions
from
'./actions'
;
// eslint-disable-next-line no-undef
const
Logger
=
logger
(
'micro'
);
...
...
@@ -119,16 +119,9 @@ export const initMicroApps = () => {
},
);
const
globalStore
=
store
.
getState
().
toJS
();
const
{
setGlobalState
}
=
initGlobalState
({
// eslint-disable-next-line no-undef
globalConfig
:
window
.
globalConfig
,
//createStoreage.get('globalConfig'),
global
:
globalStore
.
global
});
const
globalConfig
=
window
.
globalConfig
;
// globalConfig.homepage = globalConfig.homepage && /civweb4/.test(globalConfig.homepage) ? config.homepage.replace(/civweb4\//, ''): globalConfig.homepage;
console
.
log
(
globalConfig
);
setGlobalState
({
actions
.
setGlobalState
({
// eslint-disable-next-line no-undef
globalConfig
:
globalConfig
,
//createStoreage.get('globalConfig'),
...
...
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