摘要: 1.Class切换 (1)在constructor里定义初始状态 相当于开关 给个初始赋值 然后在回调函数中进行切换 constructor(props) { super(props); this.confirm = this.confirm.bind(this); this.state={ bOK 阅读全文
posted @ 2016-11-25 16:38 小儿打破贼 阅读(119) 评论(0) 推荐(0)
摘要: 以前是这样写的: 用 React.Component: React在ES6的实现中去掉了getInitialState这个hook函数,规定state在constructor中实现,如下: Class App extends React.Component { 阅读全文
posted @ 2016-11-22 11:53 小儿打破贼 阅读(746) 评论(0) 推荐(0)
摘要: 1.funciton mapStateToProps(state){ console.log("Data page:",state) //每个界面都可以打印出所有的state或者部分 const{davices,locations,batterystate} = state;//从所有的state里 阅读全文
posted @ 2016-11-21 11:30 小儿打破贼 阅读(152) 评论(0) 推荐(0)
摘要: <!DOCTYPE html><html lang="en"><head> <script> (function(){ function setFont(){ document.documentElement.style.fontSize=document.documentElement.clien 阅读全文
posted @ 2016-09-13 23:22 小儿打破贼 阅读(1109) 评论(0) 推荐(0)