vue 页面跳转

1.href//跳转刷新页面
@click = jumpCompanyProfile(item.picktextUrl)//参数是后台给的接口
jumpCompanyProfile(url){
  window.location.href = url
}
2.router//跳转时不刷新页面
1)不带参数
 @click = jumpCompanyProfile();
 jumpCompanyProfile(){
  this.$router.push('/companyProfile')
}
2)带参数
@click = jumpCompanyProfile(orgInfo.companyId)//此参数是后台给的接口
jumpCompanyProfile(currCompanyId){
  let urlParams = {
    path: '/companyProfile',//要挑战的页面路径
    query: {
      companyId: currCompanyId //要带的参数
    }
  };
  this.$router.push(urlParams);
}
//在CompanyProfile页面
data () {
  return {
    jmOrgId : 0//定义一个变量用来接收跳转时传过来的参数
  }
},
mounted() {
  this.jmOrgId = this.$route.query.companyId;//接收跳转时传过来的参数
},
methods: {
  //发送ajax时将接收到的参数传给后台
  let params = {
    "jmOrgId" : this.jmOrgId
  },
  this.$axios.post(url,params).then(res =>{

  }).catch(res=>{
  })
}

 

posted @ 2019-07-04 16:02  巴拉巴拉·芭芭拉  阅读(1778)  评论(0编辑  收藏  举报