In use vue development process, there is such a demand, click on the page of a list, you need to open a new window to show the corresponding data,
Generally, we will use the window.open (url, name, ...) to open a new window
The first is the url path, and the second is the name of the new open window, and the third of the four parameters, I did not look carefully, it is not clear what specific role
The most important is the process of using received parameters are passed
I just used a method behind the mosaic in the url parameter, as post, parameter passing method in the body I do not know,
It is roughly like this:
window.open('/home/.../target?myString=' + this.myStr + '&data=' + this.data+ '&...' .....
Here this.myStr this.data and can be seen as an array of strings and an object of the need to pass
myStr = 'entering code, knocked code'
data: [{id: 12, name: 'kitten', age: '12 '}, {id: 1, name:' big dogs ', age: '22'}]
On the array of strings is not as straightforward as passed, is not eligible as data, the solution is to use when stitching JSON.stringify first object or array to a string and then stitching up, taking in the new serial then use the data to turn back just fine JSON.parse
Therefore, the correct wording is:
window.open('/home/.../target?myString=' + this.myStr + '&data=' +JSON.stringify(this.data)+ '&...' .....
Data has now reached a new window, and how to get it? Online there are many ways to get through window.location.search, but do not know why, I did not get ah,
So I was through this. $ Route.query to take