watch检测路由

父容器检测才会有效果:

watch:{

    $router(to,from){

        console.log(to);

        console.log(from);

    }

}

在网上查看资料的时候,看到有一些说的这样写没有效果的,据说解决办法是写成‘$router’(to,from)就可以了。

猜你喜欢

转载自blog.csdn.net/mumu42/article/details/79913605