摘要: <!DOCTYPE html Document A组件 destroy msg:{{msg}} //生命周期:初始化阶段 运行中阶段 销毁阶段 Vue.component("aaa",{ template:" aaa", data:function(){ return {msg:'hello'} } 阅读全文
posted @ 2018-08-13 23:57 -柒孟- 阅读(395) 评论(0) 推荐(0) 编辑
摘要: 一、通过路由带参数进行传值 1、两个组件 A和B,A组件通过query把orderId传递给B组件(触发事件可以是点击事件、钩子函数等) this.$router.push({ path: '/conponentsB', query: { orderId: 123 } }) // 跳转到B 2、在B 阅读全文
posted @ 2018-08-13 20:33 -柒孟- 阅读(256) 评论(0) 推荐(0) 编辑
摘要: 1、元素获取 / 原生js / var ele = document.getElementById('idName'); var eleArr = document.getElementsByClassName('className'); var eleArr = document.getEleme 阅读全文
posted @ 2018-08-13 17:24 -柒孟- 阅读(2005) 评论(0) 推荐(2) 编辑
摘要: ![](https://images2018.cnblogs.com/blog/1451420/201808/1451420-20180801225110882-69003852.png) 阅读全文
posted @ 2018-08-01 22:54 -柒孟- 阅读(91) 评论(0) 推荐(0) 编辑
摘要: 一、基本概念 1、事件:用户/浏览器自身执行的某种动作(点击click、加载load,页面滚动scroll的等); 2、事件处理程序:响应某个事件的处理函数,又叫事件侦听器 二、事件流 事件流 1、事件冒泡 由IE提出 由下向上 2、事件捕获 由Netscape团队提出 由上向下 由于老版本浏览器不 阅读全文
posted @ 2018-08-01 21:55 -柒孟- 阅读(1009) 评论(0) 推荐(2) 编辑
摘要: 函数this的指向不是由函数定义时确定,而是在调用时才确定 function test() { console.log(this); } test(); //window '严格模式下为undefined' var obj = { id: 1, test: function () { console 阅读全文
posted @ 2018-08-01 16:07 -柒孟- 阅读(1771) 评论(0) 推荐(1) 编辑
摘要: 一、原型链继承 (很少用) 原理:让子类构造函数的原型指向父类型构造函数的一个实例 // 定义Animal构造函数 function Animal(color) { this.color = color; this.eat = ['肉']; // 引用类型属性 } Animal.prototype. 阅读全文
posted @ 2018-07-29 13:20 -柒孟- 阅读(1350) 评论(0) 推荐(0) 编辑
摘要: 1、工厂模式 // 定义工厂函数 function createPerson(name, age, hobby) { // 创建一个临时object对象 var obj = new Object(); // 将工厂函数的参数赋值给临时对象 obj.name = name; obj.age = age 阅读全文
posted @ 2018-07-28 22:27 -柒孟- 阅读(246) 评论(0) 推荐(0) 编辑