bailicangdu / react-pxq Goto Github PK
View Code? Open in Web Editor NEW一个 react + redux 的完整项目 和 个人总结
License: MIT License
一个 react + redux 的完整项目 和 个人总结
License: MIT License
页面:
src/Redux/Action
代码段:
export const SET_STATE = 'SET_STATE'
export const RECORD_STATE = 'RECORD_STATE'
export const SAVE_PRODUCT_LIST = 'SAVE_PRODUCT_LIST'
export const NEW_PRODUCT_DATA = 'NEW_PRODUCT_DATA'
export const DELETE_ITEM = 'DELETE_ITEM'
export const REQUEST_POSTS = 'REQUEST_POSTS'
export const RECEIVE_POSTS = 'RECEIVE_POSTS'
export const GET_DATA_START = 'GET_DATA_START'
export const GET_DATA_SUCCESS = 'GET_DATA_SUCCESS'
export const TEST_DISPATCH = 'TEST_DISPATCH'
将以上的常量写入一个 Constant.js 文件比较好, 也能避免标题的问题。
比如我有一个state的 需要重新排序。。
RT,楼主有做过react-native的app的项目吗?不知道思路跟这个项目有什么不一样的地方不?
感觉用 template 包住所有组件, 并不合理,在 template 中将所有 redux 管理的数据派发给了每一个组件, 首先组件中就存在大量不属于自身的数据, 另外,理论上每一个对 redux 数据修改的操作, 应该会造成所有组件的 render. 我试了一下没有, 可能是因为 react router 将其他组件卸载了。
哥们有联系方式吗 可以发我邮箱不 [email protected]
是否需要每个组件 都重新 config
大神 fetch在微信下的兼容性怎么样,尤其在安卓版微信中。
gyp ERR! configure error
gyp ERR! stack Error: connect ETIMEDOUT 104.20.23.46:443
gyp ERR! stack at Object.exports._errnoException (util.js:1018:11)
gyp ERR! stack at exports._exceptionWithHostPort (util.js:1041:20)
gyp ERR! stack at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1086:14)
gyp ERR! System Windows_NT 6.1.7601
gyp ERR! command "D:\node\anzhuang\node.exe" "D:\node\react-pxq-master\node_modules\node-gyp\bin\node-gyp.js" "rebuild" "--verbose" "--libsass_ext=" "--libsass_cflags=" "--libsass_ldflags=" "--libsass_library="
gyp ERR! cwd D:\node\react-pxq-master\node_modules\node-sass
gyp ERR! node -v v6.10.3
gyp ERR! node-gyp -v v3.6.2
gyp ERR! not ok
Build failed with error code: 1
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@^1.0.0 (node_modules\chokidar\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
npm ERR! Windows_NT 6.1.7601
npm ERR! argv "D:\node\anzhuang\node.exe" "D:\node\anzhuang\node_modules\npm\bin\npm-cli.js" "install"
npm ERR! node v6.10.3
npm ERR! npm v3.10.10
npm ERR! code ELIFECYCLE
<Provider store={store}> <ReactCSSTransitionGroup component="div" className="page-transition" transitionName="page-transition" transitionEnterTimeout={500} transitionLeaveTimeout={500}> {React.cloneElement(route, { key:_.uniqueId() })} </ReactCSSTransitionGroup> </Provider>, document.body.appendChild(document.createElement('div'))
并没有效果
gyp ERR! configure error
gyp ERR! stack Error: Can't find Python executable "python", you can set the PYTHON env variable.
gyp ERR! stack at PythonFinder.failNoPython (H:\demo\react-pxq-master\node_modules\node-gyp\lib\configure.js:483:19)
gyp ERR! stack at PythonFinder. (H:\demo\react-pxq-master\node_modules\node-gyp\lib\configure.js:508:16)
gyp ERR! stack at H:\demo\react-pxq-master\node_modules\graceful-fs\polyfills.js:284:29
gyp ERR! stack at FSReqWrap.oncomplete (fs.js:114:15)
gyp ERR! System Windows_NT 10.0.10586
gyp ERR! command "H:\node\node.exe" "H:\demo\react-pxq-master\node_modules\node-gyp\bin\node-gyp.js" "rebuild" "--verbose" "--libsass_ext=" "--libsass_cflags=" "--libsass_ldflags=" "--libsass_library="
gyp ERR! cwd H:\demo\react-pxq-master\node_modules\node-sass
gyp ERR! node -v v7.7.3
gyp ERR! node-gyp -v v3.6.2
gyp ERR! not ok
Build failed with error code: 1
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@^1.0.0 (node_modules\chokidar\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
npm WARN Error: EPERM: operation not permitted, lstat 'H:\demo\react-pxq-master\node_modules\scss-tokenizer\node_modules'
npm WARN { Error: EPERM: operation not permitted, lstat 'H:\demo\react-pxq-master\node_modules\scss-tokenizer\node_modules'
npm WARN errno: -4048,
npm WARN code: 'EPERM',
npm WARN syscall: 'lstat',
npm WARN path: 'H:\demo\react-pxq-master\node_modules\scss-tokenizer\node_modules' }
npm ERR! Windows_NT 10.0.10586
npm ERR! argv "H:\node\node.exe" "H:\node\node_modules\npm\bin\npm-cli.js" "install"
npm ERR! node v7.7.3
npm ERR! npm v4.1.2
npm ERR! code ELIFECYCLE
npm ERR! [email protected] postinstall: node scripts/build.js
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] postinstall script 'node scripts/build.js'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the node-sass package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node scripts/build.js
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs node-sass
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls node-sass
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR! H:\demo\react-pxq-master\npm-debug.log
npm run dist 单独生成生产环境代码,而单独启动生产环境代码的server是没写么?
好像没用用到redux
请教大神,我仿照这个项目,为什么在切换路由的时候,store里的状态还保存着,有没有办法能清掉
const rootRoute = {
path: '/',
component: Roots,
indexRoute: {
component:index
},
childRoutes: [
require('../Component/chooseProducts'),
require('../Component/helpCenter'),
require('../Component/saleRecord'),
require('../Component/allDeposit'),
require('../Component/applyRecord'),
require('../Component/applyDeposit')
]
}
const RouteConfig = (
<Router history={history} routes={rootRoute}>
</Router>
);
这种形式,有些路由跳转会报错,有些没问题;
请问要怎样改写才更好,谢谢
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@^1.0.0 (node_modules\ch okidar\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@ 1.1.1: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"ia32" })
看到大神reducer只有几个,那是怎么涵盖整个应用的状态的?状态树要怎么个设计法呢
有没有新增一个middleare对action的拦截处理例子
页面能正常显示,但是选择商品之后没有反应,上传图片功能也无效,另外浏览器报错如下:
Failed to load resource: the server responded with a status of 500 (Internal Server Error) app.js:8421 [HMR] Waiting for update signal from WDS... app.js:666 [WDS] Hot Module Replacement enabled. http://localhost:8080/pxq/dist/app.css Failed to load resource: the server responded with a status of 500 (Internal Server Error) Navigated to http://localhost:8080/index?saleMoney=&name=&phone=&picSrc=&serverId= index:15 GET http://localhost:8080/pxq/dist/app.css app.js:8421 [HMR] Waiting for update signal from WDS... app.js:666 [WDS] Hot Module Replacement enabled.
/Users/tusm/github/react-pxq/src/Component/allDeposit.jsx
文档里面的第8个生命周期componentWillUpdate不是componentWillUpdata
这里执行this.state.allDeposit黄花菜都凉了;
应该在第六个生命周期componentWillReceiveProps里面设置allDeposit,且需要使用
this.setState({'allDeposit':data.data.data.balance||0});
不然第七个生命周期的this.state又等于nextState又不更新
还有一个进入提现输入金额页面进入变成了0;这个我还没完全看
现在的代码让强迫症的人看得很辛苦:sweat_smile:
$ npm i
npm WARN prefer global [email protected] should be installed with -g
[email protected] install G:\Git Hub\react-pxq\node_modules\node-sass
node scripts/install.js
Downloading binary from https://github.com/sass/node-sass/releases/download/v3.1 3.1/win32-x64-48_binding.node
Cannot download "https://github.com/sass/node-sass/releases/download/v3.13.1/win 32-x64-48_binding.node":
ESOCKETTIMEDOUT
Hint: If github.com is not accessible in your location
try setting a proxy via HTTP_PROXY, e.g.
export HTTP_PROXY=http://example.com:1234
or configure npm proxy via
npm config set proxy http://example.com:8080
[email protected] postinstall G:\Git Hub\react-pxq\node_modules\node-sass
node scripts/build.js
Building: E:\软件\nodeJS\node.exe G:\Git Hub\react-pxq\node_modules\node-gyp\bin \node-gyp.js rebuild --verbose --libsass_ext= --libsass_cflags= --libsass_ldflag s= --libsass_library=
gyp info it worked if it ends with ok
gyp verb cli [ 'E:\软件\nodeJS\node.exe',
gyp verb cli 'G:\Git Hub\react-pxq\node_modules\node-gyp\bin\node-gyp.js ',
gyp verb cli 'rebuild',
gyp verb cli '--verbose',
gyp verb cli '--libsass_ext=',
gyp verb cli '--libsass_cflags=',
gyp verb cli '--libsass_ldflags=',
gyp verb cli '--libsass_library=' ]
gyp info using [email protected]
gyp info using [email protected] | win32 | x64
gyp verb command rebuild []
gyp verb command clean []
gyp verb clean removing "build" directory
gyp verb command configure []
gyp verb check python checking for Python executable "python2" in the PATH
gyp verb which
failed Error: not found: python2
gyp verb which
failed at getNotFoundError (G:\Git Hub\react-pxq\node_modul es\which\which.js:13:12)
gyp verb which
failed at F (G:\Git Hub\react-pxq\node_modules\which\which. js:68:19)
gyp verb which
failed at E (G:\Git Hub\react-pxq\node_modules\which\which. js:80:29)
gyp verb which
failed at G:\Git Hub\react-pxq\node_modules\which\which.js: 89:16
gyp verb which
failed at G:\Git Hub\react-pxq\node_modules\isexe\index.js: 42:5
gyp verb which
failed at G:\Git Hub\react-pxq\node_modules\isexe\windows.j s:36:5
gyp verb which
failed at FSReqWrap.oncomplete (fs.js:123:15)
gyp verb which
failed python2 { Error: not found: python2
gyp verb which
failed at getNotFoundError (G:\Git Hub\react-pxq\node_modul es\which\which.js:13:12)
gyp verb which
failed at F (G:\Git Hub\react-pxq\node_modules\which\which. js:68:19)
gyp verb which
failed at E (G:\Git Hub\react-pxq\node_modules\which\which. js:80:29)
gyp verb which
failed at G:\Git Hub\react-pxq\node_modules\which\which.js: 89:16
gyp verb which
failed at G:\Git Hub\react-pxq\node_modules\isexe\index.js: 42:5
gyp verb which
failed at G:\Git Hub\react-pxq\node_modules\isexe\windows.j s:36:5
gyp verb which
failed at FSReqWrap.oncomplete (fs.js:123:15)
gyp verb which
failed stack: 'Error: not found: python2\n at getNotFoundE rror (G:\Git Hub\react-pxq\node_modules\which\which.js:13:12)\n at F (G: \Git Hub\react-pxq\node_modules\which\which.js:68:19)\n at E (G:\Git Hu b\react-pxq\node_modules\which\which.js:80:29)\n at G:\Git Hub\react-px q\node_modules\which\which.js:89:16\n at G:\Git Hub\react-pxq\node_modu les\isexe\index.js:42:5\n at G:\Git Hub\react-pxq\node_modules\isexe\w indows.js:36:5\n at FSReqWrap.oncomplete (fs.js:123:15)',
gyp verb which
failed code: 'ENOENT' }
gyp verb check python checking for Python executable "python" in the PATH
gyp verb which
failed Error: not found: python
gyp verb which
failed at getNotFoundError (G:\Git Hub\react-pxq\node_modul es\which\which.js:13:12)
gyp verb which
failed at F (G:\Git Hub\react-pxq\node_modules\which\which. js:68:19)
gyp verb which
failed at E (G:\Git Hub\react-pxq\node_modules\which\which. js:80:29)
gyp verb which
failed at G:\Git Hub\react-pxq\node_modules\which\which.js: 89:16
gyp verb which
failed at G:\Git Hub\react-pxq\node_modules\isexe\index.js: 42:5
gyp verb which
failed at G:\Git Hub\react-pxq\node_modules\isexe\windows.j s:36:5
gyp verb which
failed at FSReqWrap.oncomplete (fs.js:123:15)
gyp verb which
failed python { Error: not found: python
gyp verb which
failed at getNotFoundError (G:\Git Hub\react-pxq\node_modul es\which\which.js:13:12)
gyp verb which
failed at F (G:\Git Hub\react-pxq\node_modules\which\which. js:68:19)
gyp verb which
failed at E (G:\Git Hub\react-pxq\node_modules\which\which. js:80:29)
gyp verb which
failed at G:\Git Hub\react-pxq\node_modules\which\which.js: 89:16
gyp verb which
failed at G:\Git Hub\react-pxq\node_modules\isexe\index.js: 42:5
gyp verb which
failed at G:\Git Hub\react-pxq\node_modules\isexe\windows.j s:36:5
gyp verb which
failed at FSReqWrap.oncomplete (fs.js:123:15)
gyp verb which
failed stack: 'Error: not found: python\n at getNotFoundEr ror (G:\Git Hub\react-pxq\node_modules\which\which.js:13:12)\n at F (G:\ \Git Hub\react-pxq\node_modules\which\which.js:68:19)\n at E (G:\Git Hub \react-pxq\node_modules\which\which.js:80:29)\n at G:\Git Hub\react-pxq \node_modules\which\which.js:89:16\n at G:\Git Hub\react-pxq\node_modul es\isexe\index.js:42:5\n at G:\Git Hub\react-pxq\node_modules\isexe\wi ndows.js:36:5\n at FSReqWrap.oncomplete (fs.js:123:15)',
gyp verb which
failed code: 'ENOENT' }
gyp verb could not find "python". checking python launcher
gyp verb could not find "python". guessing location
gyp verb ensuring that file exists: C:\Python27\python.exe
gyp ERR! configure error
gyp ERR! stack Error: Can't find Python executable "python", you can set the PYT HON env variable.
gyp ERR! stack at Object.failNoPython (G:\Git Hub\react-pxq\node_modules\nod e-gyp\lib\configure.js:483:19)
gyp ERR! stack at Object. (G:\Git Hub\react-pxq\node_modules\node -gyp\lib\configure.js:508:16)
gyp ERR! stack at G:\Git Hub\react-pxq\node_modules\graceful-fs\polyfills.js :284:29
gyp ERR! stack at FSReqWrap.oncomplete (fs.js:123:15)
gyp ERR! System Windows_NT 10.0.14393
gyp ERR! command "E:\软件\nodeJS\node.exe" "G:\Git Hub\react-pxq\node_modu les\node-gyp\bin\node-gyp.js" "rebuild" "--verbose" "--libsass_ext=" "--libsa ss_cflags=" "--libsass_ldflags=" "--libsass_library="
gyp ERR! cwd G:\Git Hub\react-pxq\node_modules\node-sass
gyp ERR! node -v v6.10.2
gyp ERR! node-gyp -v v3.6.2
gyp ERR! not ok
Build failed with error code: 1
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@^1.0.0 (node_modules\ch okidar\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@ 1.1.2: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"} )
npm ERR! Windows_NT 10.0.14393
npm ERR! argv "E:\软件\nodeJS\node.exe" "E:\软件\nodeJS\node_modules\npm\ \bin\npm-cli.js" "i"
npm ERR! node v6.10.2
npm ERR! npm v3.10.10
npm ERR! code ELIFECYCLE
npm ERR! [email protected] postinstall: node scripts/build.js
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] postinstall script 'node scripts/build.j s'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the node-sass package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node scripts/build.js
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs node-sass
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls node-sass
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR! G:\Git Hub\react-pxq\npm-debug.log
hello:
action.js中定义的
export const fetchPosts = (path, postData) => {
let url = target + path + Tool.paramType(postData);
// /shopro/data/record.json?page=1&type=UNAUDIT
return dispatch => {
dispatch(requestPosts(postData));
return fetch(url,{
mode: 'cors',
"Content-Type": "application/json",
})
.then(response => {
if(response.ok){
response.json().then(json => dispatch(receivePosts(path, json)))
}else{
console.log("status", response.status);
}
})
.catch(error => console.log(error))
}
}
想要dispatch的时候,代码中使用如下。(action已经连接了redux,所以可以通过this.props访问,不知道这样说是否正确)
this.props.fetchPosts(this.props.seting.url,this.props.seting.data)
因为文件是这样引入的
import *as action from '../../Redux/Action/Index';
我试了一下这样也是可以的
action.fetchPosts(this.props.seting.url,this.props.seting.data)
这样也能够显示数据,这样做可以么?
在window7系统谷歌浏览器下
npm run dev
会报出一个错误:
Uncaught Error: Cannot find module "isomorphic-fetch"
at webpackMissingModule (http://127.0.0.1:8088/pxq/dist/app.js:36468:89)
at Object. (http://127.0.0.1:8088/pxq/dist/app.js:36468:182)
at webpack_require (http://127.0.0.1:8088/pxq/dist/app.js:48:30)
at Object. (http://127.0.0.1:8088/pxq/dist/app.js:36375:15)
at webpack_require (http://127.0.0.1:8088/pxq/dist/app.js:48:30)
at Object. (http://127.0.0.1:8088/pxq/dist/app.js:36186:18)
at webpack_require (http://127.0.0.1:8088/pxq/dist/app.js:48:30)
at Object. (http://127.0.0.1:8088/pxq/dist/app.js:29562:15)
at webpack_require (http://127.0.0.1:8088/pxq/dist/app.js:48:30)
at Object. (http://127.0.0.1:8088/pxq/dist/app.js:23818:15)
在middleware中,处理异步的时候,next(action)和dispatch(action)的比较中;dispatch重新触发action走一遍,和next下一步不是更好么?为什么会在异步请求处理中,经常用dispatch而不是next?
ERROR in Entry module not found: Error: Cannot resolve 'file' or 'directory' /home/wizali/work/react-pxq/src/app in /home/wizali/work/react-pxq
Child html-webpack-plugin for "../index.html":
Asset Size Chunks Chunk Names
../index.html 1.42 MB 0
chunk {0} ../index.html 541 kB [rendered]
[0] ./~/html-webpack-plugin/lib/loader.js!./src/template/index.html 1.1 kB {0} [built]
[1] ./~/lodash/lodash.js 540 kB {0} [built]
[2] (webpack)/buildin/module.js 251 bytes {0} [built]
webpack: Failed to compile.
shouldComponentUpdate(nextProps, nextState) {
return !is(fromJS(this.props), fromJS(nextProps)) || !is(fromJS(this.state),fromJS(nextState))
}
这段在两个地方出现过, 可以用minx混入吧
Child extract-text-webpack-plugin:
ERROR in Node Sass does not yet support your current environment: OS X 64-bit with Unsupported runtime (57)
For more information on which environments are supported please see:
https://github.com/sass/node-sass/releases/tag/v3.13.1
Child extract-text-webpack-plugin:
ERROR in Node Sass does not yet support your current environment: OS X 64-bit with Unsupported runtime (57)
For more information on which environments are supported please see:
https://github.com/sass/node-sass/releases/tag/v3.13.1
npm报一堆错误,什么node-sass等等 是什么原因
reducer里面的内容基本没太大作用,本来是希望接受action 和必要参数后,构建new state的;
比如下面这段应该放到reducer中
list.forEach((item,index)=>{
// FIXME: 这里修改state 正确吗
this.state.productList[index] = {};
this.state.productList[index]['productName'] = item.product_name;
this.state.productList[index]['chooseState'] = false;
this.state.productList[index]['id'] = item.product_id;
this.state.productList[index]['num'] = 1;
}))
我觉得接受到action+参数product_id, num 等,在reducer中构建吧
根据这个项目,我实现做出了前端页面渲染,请问什么时候添加上服务器端和数据库的功能呀?感谢~
server.js 属于node中间层吗?
npm ERR! Windows_NT 6.1.7600
npm ERR! argv "C:\Program Files\nodejs\node.exe" "C:\Users\admin\AppData\Roaming\npm\node_modules\cnpm\node_modules\npm\bin\npm-cli.js" "--userconfig=C:\Users\admin\.cnpmrc" "--disturl=https://npm.taobao.org/mirrors/node" "--registry=https://registry.npm.taobao.org" "run" "dev"
npm ERR! node v7.5.0
npm ERR! npm v3.10.10
npm ERR! code ELIFECYCLE
npm ERR! [email protected] dev: node server.js
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] dev script 'node server.js'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the pxq package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node server.js
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs pxq
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls pxq
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
用webpack打包后的那些js 文件怎么张那个样子,怎么debug
直接两行:
npm install
npm run hot
编译正确,然后浏览器里报错
Uncaught ReferenceError: webpackJsonp is not defined
at app.js:1
(anonymous) @ app.js:1
这跟webpack版本有关系么?
希望把项目构建换成webpack2.0+
在开发环境下
请问一下为什么我的source-map 配的是 'eval-source-map', 浏览器出现的代码是babel 转过的呢 ,
个人刚接触webpack 在网上搜了很多相关 但是不是很清除 主要是无法调试
https://github.com/bailicangdu/react-pxq/blob/master/webpack.config.dev.js#L9
linux下文件名区分大小写,建议改为
var APP_FILE = path.resolve(APP_PATH, 'App');
就不会报错
我在运行run dist后,命令行一直处于Child extract-text-webpack-plugin: +7 hidden modules 卡着里不动了?这个怎么解决 win7系统
/Users/tusm/github/react-pxq/src/Component/chooseProducts.jsx
shouldComponentUpdate(nextProps, nextState) { return !is(fromJS(this.props), fromJS(nextProps))||!is(fromJS(this.state),fromJS(nextState)) && (this.state.shouldUpdata || this.state.moving) }
这里的this.state必然等于nextState,因为你上面修改是直接修改的this.state,不是采用setState,
聪明的你用了一个shouldUpdata表示来进一步判断是否需要更新;这里的 &&导致前面部分如果为false是不会执行后面的判断;应该改为 ||
like this
shouldComponentUpdate(nextProps, nextState) { return !is(fromJS(this.props), fromJS(nextProps))||!is(fromJS(this.state),fromJS(nextState)) || (this.state.shouldUpdata || this.state.moving) }
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.