|
1 | 1 | <template> |
2 | 2 | <div id="app"> |
3 | | - <transition> |
4 | | - <router-view/> |
5 | | - </transition> |
| 3 | + <transition> |
| 4 | + <router-view/> |
| 5 | + </transition> |
6 | 6 | </div> |
7 | 7 | </template> |
8 | 8 |
|
9 | 9 | <script> |
10 | 10 | export default { |
11 | | - name: 'app' |
| 11 | + name: 'app', |
| 12 | + data () { |
| 13 | + return { |
| 14 | + message: 1 |
| 15 | + } |
| 16 | + }, |
| 17 | + beforeCreate: function () { |
| 18 | + console.group('beforeCreate 创建前状态===============》') |
| 19 | + console.log('%c%s', 'color:red', 'el : ' + this.$el) // undefined |
| 20 | + console.log('%c%s', 'color:red', 'data : ' + this.$data) // undefined |
| 21 | + console.log('%c%s', 'color:red', 'message: ' + this.message) |
| 22 | + }, |
| 23 | + created: function () { |
| 24 | + console.group('created 创建完毕状态===============》') |
| 25 | + console.log('%c%s', 'color:red', 'el : ' + this.$el) // undefined |
| 26 | + console.log('%c%s', 'color:red', 'data : ' + this.$data) // 已被初始化 |
| 27 | + console.log('%c%s', 'color:red', 'message: ' + this.message) // 已被初始化 |
| 28 | + }, |
| 29 | + beforeMount: function () { |
| 30 | + console.group('beforeMount 挂载前状态===============》') |
| 31 | + console.log('%c%s', 'color:red', 'el : ' + this.$el) // 已被初始化 |
| 32 | + console.log(this.$el) |
| 33 | + console.log('%c%s', 'color:red', 'data : ' + this.$data) // 已被初始化 |
| 34 | + console.log('%c%s', 'color:red', 'message: ' + this.message) // 已被初始化 |
| 35 | + }, |
| 36 | + mounted: function () { |
| 37 | + console.group('mounted 挂载结束状态===============》') |
| 38 | + console.log('%c%s', 'color:red', 'el : ' + this.$el) // 已被初始化 |
| 39 | + console.log(this.$el) |
| 40 | + console.log('%c%s', 'color:red', 'data : ' + this.$data) // 已被初始化 |
| 41 | + console.log('%c%s', 'color:red', 'message: ' + this.message) // 已被初始化 |
| 42 | + }, |
| 43 | + beforeUpdate: function () { |
| 44 | + console.group('beforeUpdate 更新前状态===============》') |
| 45 | + console.log('%c%s', 'color:red', 'el : ' + this.$el) |
| 46 | + console.log(this.$el) |
| 47 | + console.log('%c%s', 'color:red', 'data : ' + this.$data) |
| 48 | + console.log('%c%s', 'color:red', 'message: ' + this.message) |
| 49 | + }, |
| 50 | + updated: function () { |
| 51 | + console.group('updated 更新完成状态===============》') |
| 52 | + console.log('%c%s', 'color:red', 'el : ' + this.$el) |
| 53 | + console.log(this.$el) |
| 54 | + console.log('%c%s', 'color:red', 'data : ' + this.$data) |
| 55 | + console.log('%c%s', 'color:red', 'message: ' + this.message) |
| 56 | + }, |
| 57 | + beforeDestroy: function () { |
| 58 | + console.group('beforeDestroy 销毁前状态===============》') |
| 59 | + console.log('%c%s', 'color:red', 'el : ' + this.$el) |
| 60 | + console.log(this.$el) |
| 61 | + console.log('%c%s', 'color:red', 'data : ' + this.$data) |
| 62 | + console.log('%c%s', 'color:red', 'message: ' + this.message) |
| 63 | + }, |
| 64 | + destroyed: function () { |
| 65 | + console.group('destroyed 销毁完成状态===============》') |
| 66 | + console.log('%c%s', 'color:red', 'el : ' + this.$el) |
| 67 | + console.log(this.$el) |
| 68 | + console.log('%c%s', 'color:red', 'data : ' + this.$data) |
| 69 | + console.log('%c%s', 'color:red', 'message: ' + this.message) |
| 70 | + } |
12 | 71 | } |
13 | 72 | </script> |
14 | 73 |
|
|
0 commit comments