Ways and differences of vue routing parameters

{
    
    
  path: '/market/confirmPassword',
  name: 'confirmPassword',
  component: confirmPassword,
}
let value = {
    
    
    accountType:3
}
const {
    
     accountType } = value 

1.query

this.$router.push({
    
    
  path: "/market/confirmPassword",
  //name: "confirmPassword",
  query: {
    
    
      accountType,
  },
});
this.$route.query.accountType;

2.params

this.$router.push({
    
    
  name: "confirmPassword",
  params: {
    
    
      accountType,
  },
});
this.$route.params.accountType;

1. Params can only be imported by name, and query can be used.
2. Query is equivalent to a get request. When the page jumps, you can see the request parameters in the address bar, while params is equivalent to a post request, and the parameters will not be in the address bar. display

Guess you like

Origin blog.csdn.net/m0_48076809/article/details/106696798