大家好,關(guān)于路由傳參,有個問題想請教下大家:場景:component A 有一個form表單,里面有很多字段,我點搜索跳轉(zhuǎn)到component B,根據(jù)傳來的數(shù)據(jù)進行請求數(shù)據(jù)。我的做法:以前字段少的時候,我會用類似path:/search/:id/:keywords來一個個設(shè)置,或者多字段的時候,把數(shù)據(jù)存到sessionStorage里面,到component B再獲取sessionStorage。沒有用vuex,因為刷新頁面數(shù)據(jù)會丟失。針對有很多字段的情況下,有沒有什么更好的方法?是不是用router.push({ path: 'search', query: { form: 表單data }})
vue router 傳參
慕尼黑5688855
2019-01-30 17:39:53