摘要: 举例: console.log(1); document.onclick = function() { console.log('click'); } setTimeout(function() { console.log(3) }, 3000) console.log(2); //结果:1,2,3 阅读全文
posted @ 2021-05-22 22:32 想赚点零花钱 阅读(42) 评论(0) 推荐(0) 编辑
摘要: this的指向在函数定义的时候是确定不了的,只有函数执行的时候才能确定this到底指向谁,一般情况下this的最终指向的是那个调用它的对象。 我们了解一下几个this指向: 全局作用域或者普通函数中this指向全局对象window(注意定时器里面的this指向window) 方法调用中谁调用this 阅读全文
posted @ 2021-05-22 22:28 想赚点零花钱 阅读(43) 评论(0) 推荐(0) 编辑
摘要: <div id="app"> <!--v-if: 当条件为false时, 包含v-if指令的元素, 根本就不会存在dom中--> <h2 v-if="isShow" id="aaa">{{message}}</h2> <!--v-show: 当条件为false时, v-show只是给我们的元素添加一 阅读全文
posted @ 2021-05-22 22:20 想赚点零花钱 阅读(50) 评论(0) 推荐(0) 编辑
摘要: 一.什么时候会用到: 二.和methods的区别: 举例: <div id="app"> <!--1.直接拼接: 语法过于繁琐--> <h2>{{firstName}} {{lastName}}</h2> <!--2.通过定义methods--> <!--<h2>{{getFullName()}}< 阅读全文
posted @ 2021-05-22 22:13 想赚点零花钱 阅读(50) 评论(0) 推荐(0) 编辑