/*使用npm常见的报错处理 (1)更换npm为淘宝的源 npm install -g cnpm --registry=https://registry.npm.taobao.org (2)项目运行的时候;8080端口不要被被占用;因为一个8080端口只能用于一个地方; (3)报错----ERROR in Entry module not found: Error: Cannot resolve 'file' or 'directory' C:\Users\? 想要作为引用关系的js组件文件不要随便放到一个dist文件里面;一定要放到component文件夹中; (4)在使用Ant Design组件库的时候 import { Form, Input, Select, Checkbox, DatePicker, Col, Radio, Button, Modal, message } from 'antd' const FormItem = Form.Item如上面的import里面并不需要加载Form.Item组件;只需要加载Form即可; (5)如果要引入包中的某个文件;可以直接使用相对路径如 'antd/dist/antd.css' (6) 在主文件main.js中 App组件用来<Route path="/" component={Sider}>书写路由; Sider组件用来写Link即链接单页面;并且一般如 Link 组件后面不要加 :nbsp; (7)import ReactDOM from 'react-dom' (8) 动画的实现 第1步:现在文件头部加入这个 var ReactCSSTransitionGroup =require('react-addons-css-transition-group'); 或 var ReactCSSTransitionGrop=React.addons.ReactCSSTransitionGrop; 第2步: 在要有动画的元素中加入此标签<ReactCSSTransitionGroup transitionName="example"> transitionName代表动画的名称; 第3步:写css样式; .example-enter ---》过程先变成这里的样式 .example-enter-active ---》最终变到这里的样式 .example-leave ---》这里的样式就是example-enter-active类的样式;所有这里一般不需要加样式;只要加transition即可;设置移除样式的时间; .example-leave-active ---》移除元素的过程变成这个样式 .example-enter { opacity: 0; font-size: 32px; color:red; transition: all 1s ease-in; } .example-enter.example-enter-active { opacity: 1; font-size: 12px; } .example-leave { transition: all 1s ease-in; color:red; } .example-leave.example-leave-active { font-size: 32px; opacity: 0; color:red; } (9)获取数组;操作数组 var bvaue="sdf"; 1:往数组中添加元素 ( 1:var newItems = this.state.items; newItems.push(bvaue); this.state.item---->[1,2,3,4];;newItems--->arr对象; 2:var newItems = this.state.items.push(bvaue);----》这里拿到的是length值; ) 2:删除数组中的元素 var newItems = this.state.items; newItems.splice(i, 1); this.setState({items: newItems}); * */
亿速云「云服务器」,即开即用、新一代英特尔至强铂金CPU、三副本存储NVMe SSD云盘,价格低至29元/月。点击查看>>
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。