- 博客(9)
- 收藏
- 关注
原创 js骚操作写法
//{{}:{}}二次结构const {obj1:{obj2}} ={obj1:{obj2:{name: '阿奎'}}}console.log(obj2)//...(里面可以写表达式)const obj = { name:'111', ...(0 && {age:15} || {a:111} )}console.log(obj)
2021-07-14 00:18:50
279
原创 js时间戳求时间差
const after_time = new Date('2021/3/12 23:00:00').getTime() const now_time = new Date().getTime() const hm = parseInt((now_time- after_time)/1000)//毫秒 console.log(hm) // 总共是35698毫秒 console.log('秒:',parseInt(hm%60))//35698/60=594分钟,剩余58秒 console.l
2021-03-13 09:08:11
735
原创 eslint基本配置以及使用
eslint初始化配置npx eslint --init 是为了生成.eslintrc.js文件使用 npx 是为了防止这样找目录./node_modules/.bin/eslint --init然后要做一些配置选项,跟着我来选择这个问你的项目是什么项目,我选的是最后一个,啥也不是在package.josn配置,执行yarn eslint,就会检测src下的所有js文件...
2021-02-20 16:55:05
438
原创 React 中 setState同步异步
setState可以同步也可以异步,主要看应用的场景 异步: 1. react 本身的事件 就是写在标签上面的事件,列如:onClick,onKeyDown,onChange 2. 在 生命周期里 setState 都是异步的 同步: 4. 自己注册的事件 5. setTimetou setTimeInteval 6. ajax 回调里 componentDidMount(){ 第一个 docum..
2020-10-07 09:16:26
242
原创 阿奎认为的箭头函数和普通函数的区别
//标准写法 let fun = (val) => { return val } console.log(fun('阿奎')) //简易写法 //如果只有一个参数可以将()省略,如果只有一个表达式不需要换行可以省略{}和return let fun = val => val console.log(fun('阿奎')) 一、箭头函数不能作为构造函数,不能使用new实例化 new实例化函数步骤 1、new 创建一个空对象 2、执行构造器 3
2020-10-05 21:09:37
158
1
原创 div不设置宽和高实现水平和垂直居中
<div id="wrap"> <div class="box"> <h1>666</h1> <h1>666</h1> <h1>666</h1> </div> </div>第一种方法(absolute+translate)不兼容ie8,因为这个transform属性不兼容ie8 #wrap { width: 10
2020-10-05 20:32:36
471
1
原创 ts中class类讲解
class Person { name: string static sex: string = '男' public gy = '公有的'//默认是公有的,可以被任何地方访问 private sy = '私有的'//只能在当前类内部访问 protected bh: string = '保护的'//只能在当前类内部和子类内部访问 constructor(n: string) { this.name = n console.log('保护1', this.bh)
2020-10-01 10:05:41
1346
原创 react 瀑布流和下拉加载以及图片加载
import React from 'react'import Masonry from 'masonry-layout' // 瀑布流import InfiniteScroll from 'react-infinite-scroller' // 下拉加载import imagesLoaded from 'imagesloaded' // 图片加载import axios from 'axios'import './style.less'const arr = [ 'https://dss
2020-09-30 09:08:59
1285
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人