всем привет, есть вопрос по VUE.js
почему watch выведет всего лишь один раз цифру 3 в someData хэндлере??
мне сказали что хуки жизненного цикла асинхронны вроде, но лично для меня это не прояснило ситуацию, ибо получается что watch тогда должен вывести 0 , так как event loop выполнит асинхронщину после основного кода...
export default {
name: "TestHooks",
data() {
return {
someData: 0,
};
},
beforeCreate() {
console.log("before create", this.someData, this.$el);
},
created() {
this.someData++;
console.log("created", this.someData, this.$el);
},
beforeMount() {
this.someData++;
console.log("before mount", this.someData, this.$el);
},
mounted() {
this.someData++;
console.log("mounted", this.someData, this.$el);
},
beforeDestroy() {
console.log("beforeDestroy", this.someData, this.$el);
},
destroyed() {
console.log("destroyed", this.someData, this.$el);
},
watch: {
someData(){
debugger;
console.log(this.someData);
}
}
};