摘要: html:5 +tab键 h5文档(代码更加简洁一些) html:4s + tab键 h4 + strict模式(严格模式,严格按照h4的请求进行解析) html:xt +tab键 h4 + transitional模式(过渡型文档类型) VSCode中开发React项目,安装Simple Reac 阅读全文
posted @ 2020-05-18 11:43 红桃七716 阅读(101) 评论(0) 推荐(0) 编辑
摘要: 1、(1)push(): 向数组尾部添加一个或多个元素,并返回添加新元素后的数组长度。注意,该方法会改变原数组。 1 var arr1 = [10111, 1101, 111]; 2 console.log(arr1.push(100));//4 返回数组长度 3 console.log(arr1) 阅读全文
posted @ 2020-04-17 17:06 红桃七716 阅读(128) 评论(0) 推荐(0) 编辑
摘要: //1、concat()方法,将几个字符串拼接为一个字符串,并返回新的字符串; var str1 = "nan"; var str2 = "jing"; var str3 = str1.concat(str2); console.log(str1,str2,str3) //nan jing nanj 阅读全文
posted @ 2020-04-15 22:06 红桃七716 阅读(182) 评论(0) 推荐(0) 编辑
摘要: 原稿:https://segmentfault.com/a/1190000016662929 1、路由的基本概念 (1)route:一条路由 {path:'/process',component:Process} (2)routes:一组路由 const routes = [ {path:'/pro 阅读全文
posted @ 2020-04-04 00:26 红桃七716 阅读(178) 评论(0) 推荐(0) 编辑
摘要: 1、输出格式为:保留两位小数的百分数 1、var res = (num/str1.length*100).toFixed(2) + "%";//正确,包含0.00% 2、var percent = Math.round(num1 / num2 * 10000) / 100 + "%";//80%正确 阅读全文
posted @ 2020-04-03 16:09 红桃七716 阅读(108) 评论(0) 推荐(0) 编辑
摘要: 1、test()方法 /[0-9a-zA-Z]/.test(“#¥%9ab”) //true 2、参考 https://www.cnblogs.com/cckui/p/10848395.html 阅读全文
posted @ 2020-04-03 16:07 红桃七716 阅读(95) 评论(0) 推荐(0) 编辑
摘要: 1、react实现组件分三步: 根据页面进行组件拆分 编写静态组件(HTML和CSS的编写) 实现动态组件 2、 父组件向子组件传递数据: 父组件直接在引入的子组件内写入要传递的参数即可,<List allList = {person}/> 在子组件中以 this.props接收参数 1 //父组件 阅读全文
posted @ 2020-03-12 20:13 红桃七716 阅读(191) 评论(0) 推荐(0) 编辑
摘要: React脚手架之一create-react-app搭建过程,共四步: 在项目文件夹所在目录下,npm i create-react-app -g create-react-app myreact //注意项目名不能含有大写 cd myreact npm start 过程如下: 启动开发服务器后, 阅读全文
posted @ 2020-03-12 16:11 红桃七716 阅读(141) 评论(0) 推荐(0) 编辑
摘要: ref属性:作为接口,向外暴露DOM。非受控组件。(该属性不建议使用) 1 <script type="text/babel"> 2 class MyComponent extends React.Component{ 3 handleClick= ()=>{ 4 console.log(this. 阅读全文
posted @ 2020-03-11 23:08 红桃七716 阅读(195) 评论(0) 推荐(0) 编辑
摘要: props属性:将组件外部的数据=>组件内部 任务:将组件外部的数据=>组件内部,渲染出来 1 <script type="text/babel"> 2 class MyComponent extends React.Component{ 3 render(){ 4 console.log(this 阅读全文
posted @ 2020-03-11 22:36 红桃七716 阅读(195) 评论(0) 推荐(0) 编辑