摘要: 生命周期 组件初始化 创建时componentDidMount 组件更新 更新中componentDidUpdate 组件卸载 卸载时componentWillUnmount // 自制 钟表 import React from 'react' class Clock extends React.C 阅读全文
posted @ 2021-05-11 18:00 贺可英 阅读(47) 评论(0) 推荐(0)
摘要: getTime() { let arr = [] let date = new Date() let fistDay = new Date(date.getFullYear(), date.getMonth(), 1) // 当月第一天 let lastDay = new Date(date.get 阅读全文
posted @ 2021-04-25 11:02 贺可英 阅读(837) 评论(0) 推荐(0)
摘要: <template> <img alt="Vue logo" src="./assets/logo.png"> <h1>{{ count }}</h1> <!-- vue内部对一个ref对象在模板中引入的时候 可以直接帮我们把里面的值展示出来 所以写count 而不是count.value --> 阅读全文
posted @ 2021-04-14 14:50 贺可英 阅读(2162) 评论(0) 推荐(0)
摘要: class: 定义了一切事物的抽象特点 object:类的实例 面向对象oop的3大特征: 封装 、继承、 多态 封装: 将数据操作的细节隐藏起来, 只暴露对外的接口,外界调用端不需要也不可能知道细节,只能通过接口来访问该对象。 继承:子类继承父类 子类除了具有父类所有的属性之外,也具一些更具体的特 阅读全文
posted @ 2021-04-06 17:51 贺可英 阅读(650) 评论(0) 推荐(0)
摘要: // Type Inference 类型推论 在没有明确使用类型的时候 推测一个类型 let str = 'str' // str 自动获得一个string类型 // union [ˈjuːniən] types 联合类型 let numberOrString: number | string nu 阅读全文
posted @ 2021-04-06 17:41 贺可英 阅读(111) 评论(0) 推荐(0)
摘要: interface不存在于JavaScript 用来做类型的静态检查 // interface Person {// readonly id: number; // readonly只读属性不允许改变// name: string;// age?: number // 加上问号 表示是可选属性// 阅读全文
posted @ 2021-04-06 16:12 贺可英 阅读(1065) 评论(0) 推荐(0)
摘要: npm install typescript -g TS安装 tsc + 文件名称 // 原始数据类型 和 Any类型 let isDone: boolean = false let age: number = 10 let firstName: string = 'hky' let message 阅读全文
posted @ 2021-04-06 14:26 贺可英 阅读(931) 评论(0) 推荐(0)
摘要: npm install create-react-app -g create-react-app my-project // 自己定义的文件名称 cd my-project // 进入项目 npm start // 启动服务器 启动编辑器打开文件 README.md // create-react  阅读全文
posted @ 2021-03-30 14:56 贺可英 阅读(73) 评论(0) 推荐(0)
摘要: // const obj = {// name: 'hky',// age: '28'// } // let entries = Object.entries(obj)// console.log(entries) // ES10// const fromEntries = Object.fromE 阅读全文
posted @ 2021-03-28 21:10 贺可英 阅读(71) 评论(0) 推荐(0)
摘要: // ES9 Promise 拓展 Promise.prototype.finally() // 成功失败都会执行 new Promise((resolve, reject) => { setTimeout(() => { // resolve('成功') reject('fail') }, 100 阅读全文
posted @ 2021-03-28 19:31 贺可英 阅读(57) 评论(0) 推荐(0)