路由监听

706 阅读1分钟

$route(to, from) {      
    //监听路由是否变化      
    const that = this;      
    if (to.query.t_id != from.query.t_id) {        
        that.GoInfo();      
    }    
}  


beforeRouteEnter(to, from, next) {    
    console.log(to, from, next)    
    next(vm => {      
        //  这里的vm指的就是vue实例,可以用来当做this使用      
    console.log(to);      
    console.log(from);    
});