Vue页面间传值,【params】和【query】以及localStorage缓存传值(obj缓存传值)
一,【params】和【query】传值: 传值页面:
取值页面about
二,用本地缓存传值:
传值页面:
export default {
data() {
return {
objdata:{
name:'你好',
id:1
},
time:'2021-10-02'
}; },
methods: {
shenhe(){ localStorage.setItem('objdata',JSON.stringify(objdata))//参数传值obj localStorage.setItem('time',time)//参数传值 单个 }
取值页面:
about