Vue.js method to implement page value transfer: 1. Use query to transfer value, the code is [var name=this.$route.query.name]; 2. Use params to transfer value, the code is [params : {userlist: 'userlist' }].
This method is suitable for all brands of computers
vue .js method to implement page value transfer:
1. Use query to pass value [visible in the address bar]
For example, jump from a.vue to b .vue, passname='jack'
, the code is as follows:
this.$router.push({ path: "/result", query: { name: 'jack' } });
Receive parameters in b.vue through the url in the address bar;
I created this When receiving in the function,var name=this.$route.query.name;
can receive the name parameter;
2. Use params to pass the value [address The column is not visible】
One thing to note about this method is that you need to write the name in index.js under the router when making a request.
You can pass the value together with the query;
this.$router.push({ path: "/result", name: "Result", query: { name: 'name' }, params: { usersitelist: 'userlist' } });
The value passed by params is not visible in the address bar, but the value method is the same as query. I also get the value in the created function;
var usersitelist = this.$route.params.usersitelist;
Related free learning recommendations :javascript(Video)
The above is the detailed content of How to implement page value transfer in vue.js. For more information, please follow other related articles on the PHP Chinese website!