這是什麼vue.js代碼執行:爲什麼vue.js執行不會在更新,更新和激活事件之前觸發?
- beforeCreate
- 創建
- 安裝
但不是:
- 更新前
- 更新
- 激活
https://jsfiddle.net/edwardtanguay/3hkdbuke
var vm = new Vue({
el: '#app',
data: function() {
return {
message: 'This is a test.'
}
},
methods: {
changeText: function() {
this.message = 'changed';
}
},
beforeCreate: function() {
this.$nextTick(() => {
console.log('in beforeCreate'); // gets here
});
},
created: function() {
this.$nextTick(() => {
console.log('in created'); // gets here
});
},
mounted: function() {
this.$nextTick(() => {
console.log('in mounted'); // gets here
});
},
beforeUpdate: function() {
this.$nextTick(() => {
console.log('in beforeUpdate'); //DOESN'T GET HERE
});
},
updated: function() {
this.$nextTick(() => {
console.log('in updated'); //DOESN'T GET HERE
});
},
activated: function() {
this.$nextTick(() => {
console.log('in activated'); //DOESN'T GET HERE
});
}
});