Commit f1a2ac37 authored by AU-PRO's avatar AU-PRO

add new code

parent 70ae2972
...@@ -6,7 +6,7 @@ import store from './redux/store' // Redux --> store ...@@ -6,7 +6,7 @@ import store from './redux/store' // Redux --> store
import { Provider } from 'react-redux' // Redux --> Provider import { Provider } from 'react-redux' // Redux --> Provider
// import AUPop from "./components/AUPop/AUPop.jsx" // Redux --> AUPop // import AUPop from "./components/AUPop/AUPop.jsx" // Redux --> AUPop
import { AUP_MBX_STATE, AUPOP } from "./pop" // Mobx --> AUP_MBX_STATE & AUPOP import { AUP_MBX_STATE, AUPopEv } from "./pop" // Mobx --> AUP_MBX_STATE & AUPOP
//此处为spark-cli动态生成 //此处为spark-cli动态生成
import PageHome from "./pages/PageHome/PageHome.jsx"; import PageHome from "./pages/PageHome/PageHome.jsx";
...@@ -33,7 +33,7 @@ class App extends Component { ...@@ -33,7 +33,7 @@ class App extends Component {
{/* 页面 */} {/* 页面 */}
<PageHome /> <PageHome />
{/* 弹窗 */} {/* 弹窗 */}
<AUPOP AUPopState={AUP_MBX_STATE} /> <AUPopEv AUPopState={AUP_MBX_STATE} />
</> </>
) )
} }
......
...@@ -6,9 +6,9 @@ import { toJS } from "mobx"; ...@@ -6,9 +6,9 @@ import { toJS } from "mobx";
import { Aup } from "../index.js" import { Aup } from "../index.js"
import { ConsoleStyleComponents, ConsoleStyleFlagColor } from '../api/tools.js'; import { ConsoleStyleComponents, ConsoleStyleFlagColor } from '../api/tools.js';
import './AUPopMobx.less' import './AUPopEv.less'
class AUPopMobx extends Component { class AUPopEv extends Component {
constructor (props) { constructor (props) {
super(props) super(props)
this.state = this.state || { this.state = this.state || {
...@@ -19,7 +19,7 @@ class AUPopMobx extends Component { ...@@ -19,7 +19,7 @@ class AUPopMobx extends Component {
} }
static getDerivedStateFromProps(nextProprs, preState) { static getDerivedStateFromProps(nextProprs, preState) {
console.log(`%c AUPopMobx nextProprs is: \n`, ConsoleStyleComponents, nextProprs) console.log(`%c AUPopEv nextProprs is: \n`, ConsoleStyleComponents, nextProprs)
if (nextProprs.popArr.length === 0) { if (nextProprs.popArr.length === 0) {
allowScroll() allowScroll()
} else if (nextProprs.popArr.length && preState.popArr.length == 0) { } else if (nextProprs.popArr.length && preState.popArr.length == 0) {
...@@ -30,12 +30,12 @@ class AUPopMobx extends Component { ...@@ -30,12 +30,12 @@ class AUPopMobx extends Component {
} }
} }
// TODO: 放弃使用 Mobx: 不懂就问 劳工 // TODO: 放弃使用 Mobx: --ing
// TODO: 把 closePop 改造成一个 注入函数 注入切换动画,在 render 之前 // TODO: 把 closePop 改造成一个 注入函数 注入切换动画,在 render 之前
// render 渲染 的是 closePop 处理后的 弹窗数组 // render 渲染 的是 closePop 处理后的 弹窗数组
// TODO: 考虑是否有必要 为 Aup.changePop 法 完善一个,在 AUPopMobx 内的 渲染用数组,主要为的是,做替换或者插队时,不会触发数组更新 // TODO: 考虑是否有必要 为 Aup.changePop 法 完善一个,在 AUPopMobx 内的 渲染用数组,主要为的是,做替换或者插队时,不会触发数组更新
closePop = (index) => { closePop = (index) => {
// TODO: not complete // TODO: not complete
...@@ -119,10 +119,12 @@ class AUPopMobx extends Component { ...@@ -119,10 +119,12 @@ class AUPopMobx extends Component {
} }
} }
export const AUPOP = observer(({ AUPopState }) => { export default AUPopEv
console.log(AUPopState)
return <AUPopMobx popArr={toJS(AUPopState.popArr)}/> // export const AUPOP = observer(({ AUPopState }) => {
}) // console.log(AUPopState)
// return <AUPopMobx popArr={toJS(AUPopState.popArr)}/>
// })
const debounce = (fn, wait, immediate = false) => { const debounce = (fn, wait, immediate = false) => {
let timer let timer
......
...@@ -79,62 +79,62 @@ autorun(() => { ...@@ -79,62 +79,62 @@ autorun(() => {
// author: 沈阳楠 // author: 沈阳楠
// export const EventDispatcher = (function () { export const EventDispatcher = (function () {
// function EventDispatcher() { function EventDispatcher() {
// this._events = {} this._events = {}
// } }
// EventDispatcher.ins = function () { EventDispatcher.ins = function () {
// if (EventDispatcher.ins == null) { if (EventDispatcher.ins == null) {
// EventDispatcher.ins = new EventDispatcher() EventDispatcher.ins = new EventDispatcher()
// } }
// return EventDispatcher.ins return EventDispatcher.ins
// }() }()
// EventDispatcher.prototype.dispatch = function (eventName, data) { EventDispatcher.prototype.dispatch = function (eventName, data) {
// for (let i in this._events[eventName]) { for (let i in this._events[eventName]) {
// var _event = this._events[eventName][i] var _event = this._events[eventName][i]
// _event.callback.call(_event.target.context, data) _event.callback.call(_event.target.context, data)
// } }
// } }
// EventDispatcher.prototype.addEventListener = function (eventName, callback, target) { EventDispatcher.prototype.addEventListener = function (eventName, callback, target) {
// var _events = this._events[eventName] var _events = this._events[eventName]
// if (_events) { if (_events) {
// _events.push({ _events.push({
// callback: callback, callback: callback,
// target: target target: target
// }) })
// } else { } else {
// this._events[eventName] = [{ this._events[eventName] = [{
// callback: callback, callback: callback,
// target: target target: target
// }] }]
// } }
// } }
// EventDispatcher.prototype.removeEventListener = function (eventName, callback, target) { EventDispatcher.prototype.removeEventListener = function (eventName, callback, target) {
// for (let i = this._events[eventName].length - 1; i >= 0; i--) { for (let i = this._events[eventName].length - 1; i >= 0; i--) {
// var _event = this._events[eventName][i] var _event = this._events[eventName][i]
// if (_event.callback == callback && _event.target == target) { if (_event.callback == callback && _event.target == target) {
// this._events[eventName].splice(i, 1) this._events[eventName].splice(i, 1)
// } }
// } }
// } }
// EventDispatcher.prototype.removeAllEventListener = function (eventName) { EventDispatcher.prototype.removeAllEventListener = function (eventName) {
// this._events[eventName] = null this._events[eventName] = null
// } }
// return EventDispatcher return EventDispatcher
// }()) }())
// EventDispatcher.ins.addEventListener("aaaa", this.isStart, this) EventDispatcher.ins.addEventListener("aaaa", this.isStart, this)
// EventDispatcher.ins.addEventListener("aaaa", () => { EventDispatcher.ins.addEventListener("aaaa", () => {
// EventDispatcher.ins.removeEventListener("aaaa", this.isStart, this) EventDispatcher.ins.removeEventListener("aaaa", this.isStart, this)
// }, this) }, this)
// EventDispatcher.ins.dispatch("aaaa", 3213123) EventDispatcher.ins.dispatch("aaaa", 3213123)
\ No newline at end of file \ No newline at end of file
/**
* es6-proxy-polyfill
* @version 2.1.0
* @author Ambit-Tsai <ambit_tsai@qq.com>
* @license Apache-2.0
* @see {@link https://github.com/ambit-tsai/es6-proxy-polyfill#readme}
*/
var t="[[ProxyTarget]]",n="[[Get]]",r="[[Set]]",e="[[Call]]",o=Object.defineProperty,i=Object.defineProperties,u=Object.getPrototypeOf,c=Object.getOwnPropertyDescriptor,a=!!i&&s(i),f=a?Object.__proto__?u:function(t){return"function"==typeof t?t.__proto__||{}:u(t)}:function(t){return _isVbObject(t)&&_getVbInternalOf(t).__proto__||{}};function s(t){return"function"==typeof t&&/\[native code\]/.test(t.toString())}function p(t,n){if(this instanceof p)return l(new y(t,n));h("Constructor Proxy requires 'new'")}function l(f){var s=f[t];return"function"==typeof s?function(n){var r=n[t];function o(){return this instanceof o?n["[[Construct]]"](arguments,o):n[e](this,arguments)}if(o.prototype=r.prototype,a){var c=j(n),f=O(u(r),c);for(var s in g(o,f),c=x(r,n))d(o,s)&&delete c[s];i(o,c)}else P(o,r);return o}(f):s instanceof Array?function(e){var i,f,s=e[t];a&&((i=j(e)).concat.get=function(){var t=e[n]("concat",this);return t===Array.prototype.concat?t.bind(s):t},f=O(u(s),i));return(i=x(s,e)).length.set=function(n){var i=n-s.length;e[r]("length",n,this),i&&function(n,r,e){var i=e[t];if(n>0)for(var u=i.length,a=u-n;a<u;++a){var f=c(r,a);f?o(i,a,f):i[a]=undefined,f=w(i,a,e),o(r,a,f)}else for(var s=(a=i.length)-n;a<s;++a)delete r[a]}(i,this,e)},O(f,i)}(f):function(n){var r,e,o=n[t];a&&(r=j(n),e=O(u(o),r));return r=x(o,n),O(e,r)}(f)}function y(n,r){v(n)&&v(r)||h("Cannot create proxy with a non-object as target or handler"),"REVOKED"===(f(n).__PROXY__||f(r).__PROXY__)&&h("Cannot create proxy with a revoked proxy as target or handler"),this[t]=n,this["[[ProxyHandler]]"]=r}function _(t,n){t||h("Cannot perform '"+n+"' on a proxy that has been revoked")}function h(t){throw new TypeError(t)}function v(t){return!!t&&("object"==typeof t||"function"==typeof t)}function d(t,n){return Object.prototype.hasOwnProperty.call(t,n)}p.revocable=function(n,r){this instanceof p.revocable&&h("Proxy.revocable is not a constructor");var e=new y(n,r),o=l(e);return{proxy:o,revoke:function(){e[t]=undefined,e["[[ProxyHandler]]"]=undefined,a||(f(o).__PROXY__="REVOKED")}}},y.prototype[n]=function(n,r){var e=this["[[ProxyHandler]]"];return _(e,"get"),null==e.get?this[t][n]:"function"==typeof e.get?e.get(this[t],n,r):void h("Trap 'get' is not a function: "+e.get)},y.prototype[r]=function(n,r,e){var o=this["[[ProxyHandler]]"];if(_(o,"set"),null==o.set)this[t][n]=r;else if("function"==typeof o.set){o.set(this[t],n,r,e)||h("Trap 'set' returned false for property '"+n+"'")}else h("Trap 'set' is not a function: "+o.set)},y.prototype[e]=function(n,r){var e=this["[[ProxyHandler]]"];return _(e,"apply"),null==e.apply?this[t].apply(n,r):"function"==typeof e.apply?e.apply(this[t],n,r):void h("Trap 'apply' is not a function: "+e.apply)},y.prototype["[[Construct]]"]=function(n,r){var e,o=this["[[ProxyHandler]]"];if(_(o,"construct"),null==o.construct?e=function(t,n){for(var r=[],e=0,o=n.length;e<o;++e)r.push("args["+e+"]");return new Function("Ctor","args","return new Ctor("+r.join(", ")+")")(t,n)}(this[t],n):"function"==typeof o.construct?e=o.construct(this[t],n,r):h("Trap 'construct' is not a function: "+o.construct),v(e))return e;h("Trap 'construct' returned non-object: "+e)};var b=Object.getOwnPropertyNames||function(t){var n=[];for(var r in t)d(t,r)&&n.push(r);return n},g=s(Object.setPrototypeOf)?Object.setPrototypeOf:Object.__proto__?function(t,n){return t.__proto__=n,t}:function(t,n){return o(t,"__proto__",{value:n})},O=a?Object.create:function(t,n){var r=i({},n);if(_isVbObject(r)){var e={__PROXY__:undefined};_getVbInternalOf(r).__proto__=e}return r},P=Object.assign||function(t,n){for(var r in n)d(n,r)&&(t[r]=n[r]);return t};function j(n){for(var r={},e=n[t];e=u(e);){var o=x(e,n);P(r,o)}return r.__PROXY__={get:function(){return n[t]?undefined:"REVOKED"}},r}function x(t,n){for(var r=b(t),e={},o=r.length-1;o>=0;--o)e[r[o]]=w(t,r[o],n);return e}function w(t,e,o){var i=c(t,e);return{get:function(){return o[n](e,this)},set:function(t){o[r](e,t,this)},enumerable:i.enumerable,configurable:i.configurable}}var C="undefined"==typeof Proxy?p:Proxy;export default C;
import 'babel-polyfill' import 'babel-polyfill'
export * as Aup from './api' export * as Aup from './api'
export { AUP_MBX_STATE } from './AUState' export { AUP_MBX_STATE } from './AUState'
export { AUPOP } from './AUPopMobx/AUPopMobx.jsx' export * as AUPopEv from './AUPopEv/AUPopEv.jsx'
\ No newline at end of file \ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment