Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
T
teddi
Project
Project
Details
Activity
Releases
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
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
wildfirecode13
teddi
Commits
e4374ec4
Commit
e4374ec4
authored
Nov 30, 2020
by
AU-PRO
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
for learning code
parent
f843f3bd
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
26 additions
and
18 deletions
+26
-18
apiFunction.js
project/src/mobx/apiFunction.js
+13
-5
index.js
project/src/mobx/index.js
+1
-1
mobxState.js
project/src/mobx/mobxState.js
+8
-11
PageHome.jsx
project/src/pages/PageHome/PageHome.jsx
+4
-1
No files found.
project/src/mobx/apiFunction.js
View file @
e4374ec4
...
...
@@ -5,14 +5,22 @@ const showPop1 = () => {
}
const
showPop2
=
()
=>
{
export
const
showPop2
=
()
=>
{
}
const
test01
=
(
num
)
=>
{
popState
.
popStateAdd
(
num
)
export
const
testGet
=
()
=>
{
return
popState
.
testNum
}
export
const
testComputed
=
(
num
)
=>
{
// console.log()
return
popState
.
computed4test
}
export
const
testSet
=
(
num
)
=>
{
return
popState
.
add
(
num
)
}
// export default showPop1
// export default showPop2
\ No newline at end of file
export
default
test01
\ No newline at end of file
project/src/mobx/index.js
View file @
e4374ec4
export
{
default
as
AUPOP
}
from
'./apiFunction'
\ No newline at end of file
export
*
as
AUPOP
from
'./apiFunction'
\ No newline at end of file
project/src/mobx/mobxState.js
View file @
e4374ec4
...
...
@@ -8,6 +8,7 @@ class PopState {
constructor
()
{
makeAutoObservable
(
this
,
{
nowShow
:
observable
,
testNum
:
observable
,
computed4test
:
computed
,
add
:
action
})
...
...
@@ -18,21 +19,17 @@ class PopState {
popArr
=
[]
add
=
(
num
)
=>
{
this
.
nowShow
+=
num
this
.
testNum
+=
num
}
computed4test
=
()
=>
{
console
.
log
(
'nowShow is: '
,
this
.
nowShow
)
return
`nowShow is :
${
this
.
nowShow
}
`
testNum
=
0
get
computed4test
()
{
console
.
log
(
'testNum is: '
,
this
.
testNum
)
return
`testNum is :
${
this
.
testNum
}
`
}
}
const
AUPopState
=
new
PopState
()
const
popStateAdd
=
(
num
)
=>
{
AUPopState
.
add
(
num
)
}
export
default
{
popStateAdd
}
export
default
AUPopState
project/src/pages/PageHome/PageHome.jsx
View file @
e4374ec4
...
...
@@ -62,7 +62,10 @@ class PageHome extends Component {
}
mobxAction01
=
()
=>
{
AUPOP
.
test01
(
1
)
console
.
log
(
'AUPOP is: '
,
AUPOP
)
AUPOP
.
testSet
(
1
)
console
.
log
(
'AUPOP.testGet::::: '
,
AUPOP
.
testGet
())
console
.
log
(
'AUPOP.testComputed::::: '
,
AUPOP
.
testComputed
())
}
openColorful
=
()
=>
{
...
...
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