This topic created in 1375 days ago, the information mentioned may be changed or developed.
以前看到过,忘记 收藏了(学会了),
就是解决 vue router 传参(大对象)通过 sessionstorage 和 localstorage 传递。 这样下个路由(新窗口)可以访问到。
我记得有这么一个插件是专门做这个事情的。想问问前端大佬们有没有在用的。
(这功能不难,有现成的明天就不自己写了。)
11 replies 2022-08-09 19:36:01 +08:00  | | 1 jarven123 Aug 8, 2022 需求明显有问题,如果一个页面的参数强行依赖 sessionstorage 和 localstorage ,这些没了呢? |
 | | 2 dcsuibian Aug 8, 2022 如果要在新窗口访问到的话,我大概会用 query-string 转成字符串放在链接里,然后用 vue-router 的路由守卫获取到
比较好奇你这是什么场景需要开个新窗口 单页路由的话跳转传参直接用 vue-router 内置的就好了 如果是其它网页的,那你说的 localstorage 也失效了,因为不是同源的嘛 |
 | | 6 Desiree Aug 9, 2022 vue-localstorage |
 | | 8 davin Aug 9, 2022 新窗口?不同源的话还是 postMessage 吧 |