摘要: redux安装 npm add redux Ant Design 安装 npm add antd 引入css import 'antd/dist/antd.css'; 组件使用 import { Input, Button,List, Typography, Divider } from 'antd 阅读全文
posted @ 2020-07-02 21:32 雪糕战士 阅读(252) 评论(0) 推荐(0) 编辑
摘要: 安裝:cnpm i react-transition-group 详细介绍: https://reactcommunity.org/react-transition-group/css-transition /* 显示 */ /* fade-appear第一次显示执行的样式 */ .fade-ent 阅读全文
posted @ 2020-07-01 22:44 雪糕战士 阅读(610) 评论(0) 推荐(0) 编辑
摘要: 在文件目录下执行安装命令: npm add axios 在文件中引入 import axios from 'axios' 使用范例: componentDidMount(){ axios.get('http://localhost:3001/todolist') .then((res)=>( thi 阅读全文
posted @ 2020-06-30 22:51 雪糕战士 阅读(1464) 评论(0) 推荐(0) 编辑
摘要: http://g.widyun.com/ 阅读全文
posted @ 2020-06-30 08:27 雪糕战士 阅读(460) 评论(0) 推荐(0) 编辑
摘要: 生命周期函数指在某一个时刻组件会自动调用执行的函数 https://zh-hans.reactjs.org/docs/react-component.html componentWillMount 在渲染前调用,在客户端也在服务端。 componentDidMount : 在第一次渲染后调用,只在客 阅读全文
posted @ 2020-06-29 22:31 雪糕战士 阅读(91) 评论(0) 推荐(0) 编辑
摘要: uc手机浏览器会过滤包含ad字符的图片路径,禁止其显示,给图片命名或存放图片路径时 尽量不要含有ad字符。如ad_img 外链样式不生效问题:查看html与css编码格式是否一致,要是不一致就会出现浏览器端样式生效,手机端不生效问题 阅读全文
posted @ 2020-06-29 21:44 雪糕战士 阅读(452) 评论(0) 推荐(0) 编辑
摘要: res引用的意思,用来获取元素的dom,官方并不推荐 react新特性中res等于一个函数,这个函数会自动接收一个参数。这是代表构建了一个ref,通过this.input来指向 input Dom节点 之前使用e.target.value来获取input值,现在通过ref引用的this.input来 阅读全文
posted @ 2020-06-28 22:14 雪糕战士 阅读(243) 评论(0) 推荐(0) 编辑
摘要: 当组件的state或者props发生改变的时候,render函数就会重新执行 当父组件的render函数被运行时,它的子组件render都将被重新运行一次 阅读全文
posted @ 2020-06-27 23:22 雪糕战士 阅读(168) 评论(0) 推荐(0) 编辑
摘要: 文档连接:https://reactjs.org/docs/typechecking-with-proptypes.html PropTypes:就是用来验证组件实例的属性是否符合要求,PropTypes 告诉 React,这个 title 属性是必须的,而且它的值必须是字符串。 defaultPr 阅读全文
posted @ 2020-06-27 23:11 雪糕战士 阅读(175) 评论(0) 推荐(0) 编辑
摘要: 1 父传子 2 父组件: 赋值给一个属性 子组件:return {this.props.item} 3 子组件通过this.props.属性名,这样的方式获取传递值 4 5 子传父 6 父组件:<Todoitem delitem = {this.handleItemDel} /> 7 父组件通过de 阅读全文
posted @ 2020-06-27 19:48 雪糕战士 阅读(59) 评论(0) 推荐(0) 编辑