摘要:
import React, { Component } from "react"; export default class Shengming extends Component { // 调用父类的 constructor方法;传递props属性,染发props属性起作用 constructor 阅读全文
摘要:
react的生命周期,分为3三个阶段, 挂载阶段 constructor(){} UNSAFE_componentWillMount(){} == componentWillMount(在17版本中将废除){} componentDidMount(){ 发送异步请求的} render(){} 跟新: 阅读全文
摘要:
子组件 import React, { Component } from 'react'; class Web1 extends Component { constructor(props) { super(props); this.state = { num:100, } } son(){ thi 阅读全文
摘要:
爷爷组件 import React, { Component } from "react"; import "./App.css"; import TestHanderClick from "./components/TestHanderClick"; import proptypeskey fro 阅读全文
摘要:
首先你需要下载 cnpm i prop-types 安装验证数据类型的插件; 子组件 import React, { Component } from "react"; import "./base.css"; // 引入验证格式类型的插件 import proptypeskey from "pro 阅读全文
摘要:
<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);//这 阅读全文
摘要:
父组件 <TestHanderClick bg="blue"> <p> 如果我要显示的话,父组件是双标签,子组件中有this.props.children</p> <div>类似于匿名插槽</div> </TestHanderClick> 子组件 import React, { Component 阅读全文
摘要:
子组件 import React, { Component } from "react"; import "./base.css" // 父组件 export class TestHanderClick extends Component { // static defaultProps是默认的写法 阅读全文
摘要:
给当前元素添加一个类是通过className来处理的; 引入css;直接from XXXX import React, { Component } from "react"; // 以内css,直接form import "./base.css" export class TestHanderCli 阅读全文
摘要:
import React, { Component } from "react"; export class TestHanderClick extends Component { constructor(props) { super(props); this.state = { cont: "内容 阅读全文