Vue ---钩子函数
来源:互联网 发布:原装ubuntu的电脑 编辑:程序博客网 时间:2024/05/18 21:41
<!DOCTYPE html><html><head> <title></title> <script type="text/javascript" src="https://cdn.jsdelivr.net/vue/2.1.3/vue.js"></script></head><body><div id="app"> <p>{{ message }}</p></div><script type="text/javascript"> var app = new Vue({ el: '#app', data: { message : "xuxiao is boy" }, beforeCreate: function () { console.group('beforeCreate 创建前状态===============》'); console.log("%c%s", "color:red" , "el : " + this.$el); //undefined console.log("%c%s", "color:red","data : " + this.$data); //undefined console.log("%c%s", "color:red","message: " + this.message) }, created: function () { console.group('created 创建完毕状态===============》'); console.log("%c%s", "color:red","el : " + this.$el); //undefined console.log("%c%s", "color:red","data : " + this.$data); //已被初始化 console.log("%c%s", "color:red","message: " + this.message); //已被初始化 }, beforeMount: function () { console.group('beforeMount 挂载前状态===============》'); console.log("%c%s", "color:red","el : " + (this.$el)); //已被初始化 console.log(this.$el); console.log("%c%s", "color:red","data : " + this.$data); //已被初始化 console.log("%c%s", "color:red","message: " + this.message); //已被初始化 }, mounted: function () { console.group('mounted 挂载结束状态===============》'); console.log("%c%s", "color:red","el : " + this.$el); //已被初始化 console.log(this.$el); console.log("%c%s", "color:red","data : " + this.$data); //已被初始化 console.log("%c%s", "color:red","message: " + this.message); //已被初始化 }, beforeUpdate: function () { console.group('beforeUpdate 更新前状态===============》'); console.log("%c%s", "color:red","el : " + this.$el); console.log(this.$el); console.log("%c%s", "color:red","data : " + this.$data); console.log("%c%s", "color:red","message: " + this.message); }, updated: function () { console.group('updated 更新完成状态===============》'); console.log("%c%s", "color:red","el : " + this.$el); console.log(this.$el); console.log("%c%s", "color:red","data : " + this.$data); console.log("%c%s", "color:red","message: " + this.message); }, beforeDestroy: function () { console.group('beforeDestroy 销毁前状态===============》'); console.log("%c%s", "color:red","el : " + this.$el); console.log(this.$el); console.log("%c%s", "color:red","data : " + this.$data); console.log("%c%s", "color:red","message: " + this.message); }, destroyed: function () { console.group('destroyed 销毁完成状态===============》'); console.log("%c%s", "color:red","el : " + this.$el); console.log(this.$el); console.log("%c%s", "color:red","data : " + this.$data); console.log("%c%s", "color:red","message: " + this.message) } })</script></body></html>
阅读全文
0 0
- vue钩子函数
- Vue ---钩子函数
- vue钩子函数
- Vue 钩子函数
- vue生命周期钩子函数
- vue 钩子函数图解
- Vue的钩子函数
- vue钩子函数(软文)
- 【Vue2.0】vue生命周期中的钩子函数
- 18、vue.js 之路由钩子函数
- vue js 的生命周期和钩子函数
- Vue的生命周期(钩子函数)
- vue.js生命周期钩子函数及缓存
- vue、vueRoute钩子函数的理解
- 对vue生命周期-钩子函数的理解
- vue生命周期中,钩子函数执行顺序
- vue生命周期和钩子函数的理解
- Vue之过渡组件的钩子函数
- 50. Pow(x, n)
- Javassist Enhancement failed:异常解决方法
- Docker 入门
- 剑指Offer学习之面试题12 :打印1 到最大的n 位数
- 【心灵鸡汤】谁的青春不迷茫
- Vue ---钩子函数
- codeforces 811C Vladik and Memorable Trip
- linux获取网络信息函数
- 冒泡法,熟悉熟悉
- 剑指Offer学习之面试题13 :在O(1)时间删除链表结点
- 索引+索引的类型+创建索引
- 读java编程那些事——查漏补缺
- 1091 线段的重叠
- 详解C语言中的stdin,stdout,stderr