上一页 1 ··· 8 9 10 11 12 13 14 15 下一页
摘要: 子组件 import React, { Component } from 'react'; class Web1 extends Component { constructor(props) { super(props); this.state = { num:100, } } son(){ thi 阅读全文
posted @ 2020-08-22 12:07 何人陪我共长生 阅读(247) 评论(0) 推荐(0)
摘要: 爷爷组件 import React, { Component } from "react"; import "./App.css"; import TestHanderClick from "./components/TestHanderClick"; import proptypeskey fro 阅读全文
posted @ 2020-08-21 20:37 何人陪我共长生 阅读(1352) 评论(0) 推荐(0)
摘要: 首先你需要下载 cnpm i prop-types 安装验证数据类型的插件; 子组件 import React, { Component } from "react"; import "./base.css"; // 引入验证格式类型的插件 import proptypeskey from "pro 阅读全文
posted @ 2020-08-20 22:13 何人陪我共长生 阅读(546) 评论(0) 推荐(0)
摘要: <input type="file" @change="demo"> if(e.target.files[0]&&e.target.files[0].type.indexOf("mp4")!=-1){//检查视频 console.log("e",e.target.files[0].type);//这 阅读全文
posted @ 2020-08-19 11:13 何人陪我共长生 阅读(5987) 评论(0) 推荐(0)
摘要: 父组件 <TestHanderClick bg="blue"> <p> 如果我要显示的话,父组件是双标签,子组件中有this.props.children</p> <div>类似于匿名插槽</div> </TestHanderClick> 子组件 import React, { Component 阅读全文
posted @ 2020-08-18 22:52 何人陪我共长生 阅读(868) 评论(0) 推荐(0)
摘要: 子组件 import React, { Component } from "react"; import "./base.css" // 父组件 export class TestHanderClick extends Component { // static defaultProps是默认的写法 阅读全文
posted @ 2020-08-18 22:29 何人陪我共长生 阅读(355) 评论(0) 推荐(0)
摘要: 给当前元素添加一个类是通过className来处理的; 引入css;直接from XXXX import React, { Component } from "react"; // 以内css,直接form import "./base.css" export class TestHanderCli 阅读全文
posted @ 2020-08-18 21:40 何人陪我共长生 阅读(997) 评论(0) 推荐(0)
摘要: import React, { Component } from "react"; export class TestHanderClick extends Component { constructor(props) { super(props); this.state = { cont: "内容 阅读全文
posted @ 2020-08-17 23:15 何人陪我共长生 阅读(422) 评论(0) 推荐(0)
摘要: 执行如下: npm install -g react npm install react --save 类似这种依赖项(react,react-dom 等)报错,哪个报错执行哪个即可 执行上述两句就 ok 啦 阅读全文
posted @ 2020-08-17 22:58 何人陪我共长生 阅读(1769) 评论(0) 推荐(0)
摘要: 我发现 state 有两种不同的写法 在构造器 constructor 中是这样的 有 this. constructor(props){//参数必须要有 super(props); this.state={ num:10 } } } 没有 constructor state={ num:10 } 阅读全文
posted @ 2020-08-17 22:57 何人陪我共长生 阅读(464) 评论(0) 推荐(0)
上一页 1 ··· 8 9 10 11 12 13 14 15 下一页