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
ad390144
Commit
ad390144
authored
Dec 05, 2020
by
AU-PRO
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add new code
parent
9b23e470
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
91 additions
and
14 deletions
+91
-14
app.jsx
project/src/app.jsx
+2
-3
AUPopMobx.jsx
project/src/pop/AUPopMobx/AUPopMobx.jsx
+9
-3
AUState.js
project/src/pop/AUState.js
+78
-7
showPop.js
project/src/pop/api/showPop.js
+2
-1
No files found.
project/src/app.jsx
View file @
ad390144
...
...
@@ -6,13 +6,12 @@ import store from './redux/store' // Redux --> store
import
{
Provider
}
from
'react-redux'
// Redux --> Provider
// import AUPop from "./components/AUPop/AUPop.jsx" // Redux --> AUPop
import
{
AUPopState
,
popWatcher
}
from
'./pop/AUState.js'
// Mobx --> AUState
import
{
AUPopState
}
from
'./pop/AUState.js'
// Mobx --> AUState
import
AUPop
from
"./pop/AUPopMobx/AUPopMobx.jsx"
// Mobx --> AUPop
//此处为spark-cli动态生成
import
PageHome
from
"./pages/PageHome/PageHome.jsx"
;
class
App
extends
Component
{
// use redux type
// render() {
// return (
...
...
@@ -34,7 +33,7 @@ class App extends Component {
{
/* 页面 */
}
<
PageHome
/>
{
/* 弹窗 */
}
<
AUPop
AUPopState=
{
AUPopState
.
popArr
}
/>
<
AUPop
AUPopState=
{
AUPopState
}
/>
</>
)
}
...
...
project/src/pop/AUPopMobx/AUPopMobx.jsx
View file @
ad390144
...
...
@@ -4,6 +4,7 @@ import { AUPopState, popWatcher } from '../../pop/AUState.js' // Mobx --> AUStat
import
popMap
from
'../PopMap.js'
import
{
observer
}
from
'mobx-react-lite'
import
{
toJS
}
from
"mobx"
;
import
'./AUPopMobx.less'
...
...
@@ -96,6 +97,11 @@ class AUPopMobx extends Component {
}
}
const
AUPop
=
observer
(({
AUPopState
})
=>
<
AUPopMobx
popState=
{
AUPopState
}
/>
)
export
default
AUPop
\ No newline at end of file
// export default observer(({ AUPopState }) => <AUPopMobx AUPopState={AUPopState} /> )
export
default
observer
(({
AUPopState
})
=>
{
console
.
log
(
AUPopState
)
return
(
<
AUPopMobx
pop=
{
toJS
(
AUPopState
.
popArr
)
}
/>
// <span>Seconds passed: {AUPopState.nowShow}</span>
)
})
\ No newline at end of file
project/src/pop/AUState.js
View file @
ad390144
...
...
@@ -5,16 +5,19 @@ import { CONSO_START_mark, ConsoleStyleTitle, ConsoFunc } from './api/tools'
// useProxies: "never"
// })
class
PopState
{
export
class
PopState
{
nowShow
popArr
aaa
constructor
()
{
this
.
popArr
=
[]
this
.
nowShow
=
''
this
.
nowShow
=
0
this
.
aaa
=
arguments
[
0
]
// makeAutoObservable(this)
makeAutoObservable
(
this
,
{
nowShow
:
observable
,
popArr
:
observable
,
addPop
:
action
.
bound
,
changePop
:
action
.
bound
,
computedPopArr
:
computed
...
...
@@ -23,12 +26,14 @@ class PopState {
addPop
=
(
data
)
=>
{
console
.
log
(
`
${
CONSO_START_mark
}
\n addPop:`
,
ConsoleStyleTitle
,
data
)
this
.
nowShow
+=
1
this
.
popArr
.
push
(
data
)
}
changePop
=
(
data
)
=>
{
console
.
log
(
`
${
CONSO_START_mark
}
\n changePop:`
,
ConsoleStyleTitle
,
data
)
this
.
popArr
=
[
data
]
console
.
log
(
`
${
CONSO_START_mark
}
\n changePop:`
,
ConsoleStyleTitle
,
this
.
popArr
)
this
.
nowShow
+=
1
// this.popArr = [data]
}
get
computedPopArr
()
{
...
...
@@ -36,8 +41,74 @@ class PopState {
}
}
export
const
AUPopState
=
new
PopState
()
export
const
AUPopState
=
new
PopState
(
100
)
export
const
popWatcher
=
autorun
(()
=>
{
autorun
(()
=>
{
console
.
log
(
`
${
CONSO_START_mark
}
\n AUTORUN::: this.popArr:`
,
ConsoleStyleTitle
,
AUPopState
.
popArr
)
return
AUPopState
.
popArr
})
// ready for mobx can't use
// author: 沈阳楠
// export const EventDispatcher = (function () {
// function EventDispatcher() {
// this._events = {}
// }
// EventDispatcher.ins = function () {
// if (EventDispatcher.ins == null) {
// EventDispatcher.ins = new EventDispatcher()
// }
// return EventDispatcher.ins
// }()
// EventDispatcher.prototype.dispatch = function (eventName, data) {
// for (let i in this._events[eventName]) {
// var _event = this._events[eventName][i]
// _event.callback.call(_event.target.context, data)
// }
// }
// EventDispatcher.prototype.addEventListener = function (eventName, callback, target) {
// var _events = this._events[eventName]
// if (_events) {
// _events.push({
// callback: callback,
// target: target
// })
// } else {
// this._events[eventName] = [{
// callback: callback,
// target: target
// }]
// }
// }
// EventDispatcher.prototype.removeEventListener = function (eventName, callback, target) {
// for (let i = this._events[eventName].length - 1; i >= 0; i--) {
// var _event = this._events[eventName][i]
// if (_event.callback == callback && _event.target == target) {
// this._events[eventName].splice(i, 1)
// }
// }
// }
// EventDispatcher.prototype.removeAllEventListener = function (eventName) {
// this._events[eventName] = null
// }
// return EventDispatcher
// }())
// EventDispatcher.ins.addEventListener("aaaa", this.isStart, this)
// EventDispatcher.ins.addEventListener("aaaa", () => {
// EventDispatcher.ins.removeEventListener("aaaa", this.isStart, this)
// }, this)
// EventDispatcher.ins.dispatch("aaaa", 3213123)
\ No newline at end of file
project/src/pop/api/showPop.js
View file @
ad390144
...
...
@@ -62,7 +62,6 @@ export const AupopCleanAll = () => {
}
/**
* 获取弹窗数组
*/
...
...
@@ -70,3 +69,5 @@ export const AupopGetPopArr = () => {
return
[]
}
// IntersectionObserver
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