摘要: 我们已经非常熟悉单个的vue组件的生命周期执行顺序了,但是,如果有嵌套组件,父子组件的生命周期的执行顺序是什么? 当父子组件在加载的时候,执行的先后顺序为 父beforeCreate -> 父created -> 父beforeMount -> 子beforeCreate -> 子created - 阅读全文
posted @ 2022-04-02 15:25 musicBird 阅读(667) 评论(0) 推荐(0)
摘要: 1 Function.prototype.bind1 = function(){ 2 // 将类数组转化成数组 3 let arr = Array.prototype.slice.call(arguments) 4 5 //提取this 6 const t = arr.shift() 7 8 //保 阅读全文
posted @ 2022-04-02 15:12 musicBird 阅读(37) 评论(0) 推荐(0)
摘要: this指向两句话口诀: 1.this永远指向函数执行的环境,而不是声明的环境 2.箭头函数的this指向父级 一、正常函数的this function fn1(){ console.log(this) } fn1() //this window fn1.call({x:100}) //this { 阅读全文
posted @ 2022-04-02 11:15 musicBird 阅读(48) 评论(0) 推荐(0)