Vue - Router routing jump parameter (object/array) solution to the problem of parameter loss after the target page is refreshed

foreword

For example, there is a list page. After clicking, you can enter the details page with parameters. When the details page is refreshed, the carried parameters cannot be obtained.

What we want is, no matter how we refresh the target page,

There will be no situation where it cannot be obtained, as shown in the following figure:
insert image description here

solution

If you pass queryan object or an array by means of , it will be coerced into the address bar [object Object], so you can't get it.

But you can convert it by passing the object parameter, through the JSON.stringify()method ,

Use on the receiving page (target page JSON.parse()) and go back.

// 列表页

const data = {
   
    
     type: 'a1', value

Guess you like

Origin blog.csdn.net/weixin_44198965/article/details/123679370