2020.11.25
react 和 vue 区别
vue 实现双向绑定 watch computed this.nextTick()
vue 通信方式
写一下发布订阅
[{ key: [fn, fn, fn] }]
state = {
index: 1,
};题一
componentDidMount(){
this.setState({
index:this.state.index+1
})
console.log('state',this.state.index)
}
题二
componentDidMount(){
setTimeout(()=>{
this.setState({
index:this.state.index+1
})
console.log('state',this.state.index)
},0)
}
题三
componentDidMount(){
this.setState({
index:this.state.index+1
},()=>{
console.log(this.state.index)
})
this.setState({
index:this.state.index+1
},()=>{
console.log(this.state.index)
})
}react 事件机制
react 性能优化
数组排序
xss csrf csp
跨域
总结: bind 方法可以绑定 this 和参数,但一旦参数被绑定,后续的 bind 调用不会覆盖已经绑定的参数。
在这段代码中,c() 最终调用的是 a('xxx'),因此输出是 xxx。
var calc = generatorCalc(); calc(1); calc(2)(3); calc() // 6 实现 generatorCalc
命名规范
类数组 与数组 的转化的问题
扩展运算符的使用
链式调用的设计
同步代码 总是最先执行。
微任务(如 Promise.then、await 后面的代码)会在同步代码执行完毕后立即执行。
宏任务(如 setTimeout)会在微任务队列清空后执行。
Promise 状态
一个 Promise
适配问题
全局滚动与弹窗的问题(没有遇到)
兼容性要求 > Android 8.0 css 特性兼容性要求 currentCorlor 变量
css less 哪些能力
变量
嵌套
跑马灯的组件
无限循环滚动
webpack 性能优化方面
HMR 工作原理
new 函数 和 直接 函数
当作为未绑定对象被调用时,this 默认指向全局上下文或者浏览器中的 window 对象。然而,如果函数在严格模式下被执行,上下文将被默认为 undefined
当通过 new 一个对象的实例的方式来调用一个函数的时候,this 的值将被设置为新创建的实例
最后更新于
这有帮助吗?