美文网首页
组件内导航之beforeRouteUpdate的使用

组件内导航之beforeRouteUpdate的使用

作者: 阿克兰 | 来源:发表于2020-11-06 10:53 被阅读0次
    export default{
       data(){
             return {}
      },
       beforeRouteUpdate(to,from,next){
            console.log(to,from,next)
            if(to.fullPath!=from.fullPath){
                next()
                this.changeUser()
            }
        },
        methods:{
             changeUser(){
                getUserBaseInfo({userId:this.$route.params.id}).then(res=>{
                if(res.success){
                    this.stuInfo = res.data;
                }else{
                    this.$message.error(res.message)
                }
                
            })
            }  
        }  
    }
    

    相关文章

      网友评论

          本文标题:组件内导航之beforeRouteUpdate的使用

          本文链接:https://www.haomeiwen.com/subject/alftbktx.html