If the parameter is in the path
1. Open a new window
router.js
path: '/project/:id'
var { href } = this.$router.resolve({
path: '/project'.query: {
id: this.id
}
});
window.open(href,'_blank');
Copy the code
Get the parameter: this.$route.query.id
If the parameter is not in the path
1. Do not open a new window
var href = this.$router.push({
name: 'Item List'.params: {
msg : this.msg
}
});
Copy the code
Get this.$route.params.msg
2. Open a new window
var { href } = this.$router.resolve({
name: 'Item List'});localStorage.setItem("msg".this.msg)
window.open(href,'_blank');
Copy the code
Get parameters:
if (localStorage.getItem('msg')) {this.m= localStorage.getItem('msg');
localStorage.clear();
};
Copy the code