摘要: 参考:https://blog.csdn.net/qq_33656559/article/details/107223811 vscode安装go语言的调试插件,按官方给出的方法很简单,在cmd下执行这个命令(最好使用git执行命令行): go get -u github.com/derekpark 阅读全文
posted @ 2021-06-17 20:31 雪糕战士 阅读(326) 评论(0) 推荐(0) 编辑
摘要: tsconfig.json文件中添加"types":["node"],即可 阅读全文
posted @ 2021-01-20 22:52 雪糕战士 阅读(1302) 评论(0) 推荐(0) 编辑
摘要: 父组件: 1 import React, { 2 Component 3 } from "react"; 4 import TreeNode from "../components/TreeNode"; 5 //数据源 6 const treeData = { 7 key: 0, //标识唯⼀性 8 阅读全文
posted @ 2020-09-13 14:31 雪糕战士 阅读(612) 评论(0) 推荐(0) 编辑
摘要: 弹窗类组件的要求弹窗内容在A处声明,却在B处展示。react中相当于弹窗内容看起来被render到⼀个组件⾥⾯ 去, 实际改变的是⽹⻚上另⼀处的DOM结构。 父组件: 1 import React, { Component } from "react"; 2 import { Button } fr 阅读全文
posted @ 2020-09-12 23:55 雪糕战士 阅读(183) 评论(0) 推荐(0) 编辑
摘要: 1、react按需加载、装饰器配置 使⽤第三⽅组件antd npm install antd --save 1 import React, { Component } from 'react' 2 import Button from 'antd/lib/button' 3 import "antd 阅读全文
posted @ 2020-09-05 22:39 雪糕战士 阅读(215) 评论(0) 推荐(0) 编辑
摘要: 高级组件概念: 为了提⾼组件复⽤率,可测试性,就要保证组件功能单⼀性; 但是 若要满⾜复杂需求就要扩展功能单⼀的组件,在React⾥就有了 HOC(Higher-Order Components)的概念, 定义:⾼阶组件是⼀个⼯⼚函数,它接收⼀个组件并返回另⼀个组 件。 1 import React 阅读全文
posted @ 2020-09-02 22:38 雪糕战士 阅读(194) 评论(0) 推荐(0) 编辑
摘要: 1 react分为聚名卡槽和匿名卡槽两种 2 3 4 5 import React,{Component} from 'react' 6 import Layout from './Layout' 7 import {Consumer} from '../Appcontent' 8 9 class 阅读全文
posted @ 2020-09-01 23:36 雪糕战士 阅读(178) 评论(0) 推荐(0) 编辑
摘要: https://reactjs.org/docs/context.html官网链接:React官⽅⽂档中,Context被归类为⾼级部分(Advanced), 属于React的⾼级API,但官⽅并不建议在稳定版的App中使⽤ Context。封装Appcontent.js方便其他组件调用: impo 阅读全文
posted @ 2020-08-31 23:23 雪糕战士 阅读(280) 评论(0) 推荐(0) 编辑
摘要: 官网地址:https://zh-hans.reactjs.org/docs/react-component.html#static-getderivedstatefrompropsV17可能会废弃的三个⽣命周期函数⽤getDerivedStateFromProps 替代,⽬前使⽤的话加上UNSAFE 阅读全文
posted @ 2020-08-31 22:22 雪糕战士 阅读(120) 评论(0) 推荐(0) 编辑
摘要: 父传子: 3 父组件代码: 4 import React from 'react'; 5 import User from './pages/User' 6 import Search from './pages/Search' 7 8 function App() { 9 10 const con 阅读全文
posted @ 2020-08-30 23:33 雪糕战士 阅读(345) 评论(0) 推荐(0) 编辑