【发布时间】:2017-08-31 13:48:25
【问题描述】:
这段 vue.js 代码执行了什么:
- 创建前
- 已创建
- 已安装
但不是:
- 更新前
- 更新
- 已激活
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
});
}
});
【问题讨论】:
标签: vue.js