Vue watch到底是在create之前还是mounted之后执行还是create之前还是mounted之后都会执行
watch: {
$route: "getParams",
},
mounted() {
this.getTaskInfo(this.taskId);
},
methods: {
getParams() {
const routerParams = this.$route.query.id;
if (routerParams) {
this.getTaskInfo(routerParams);
}
},
}
我认为是在mounted之前,但是我感觉create应该是之后,对于create和mounted我也有点混,我觉得啊,create就是我得到了东西,但是我页面上还没有渲染,而mouthed是重新渲染页面;