localStorage表单提交传值

在登录页面填写了手机号和座位号,这里我要把把座位号和电话号码传到后台

思路:
百度一下先
在这里插入图片描述
方法有很多

我决定用localStorage

cookie,session,localstorage,sessionStorage区别和介绍

 // 把表单数据传给main页面
localStorage.setItem('userInfo', JSON.stringify(this.loginForm)) // JSON.stringify 将JSON转为字符串存到变量里

// 接收传给main页面的表单数据
var userInfo = localStorage.getItem('userInfo')
this.userInfo = JSON.parse(userInfo) // 转为JSON
console.log('seat ' + this.userInfo.seat)

在这里插入图片描述

猜你喜欢

转载自blog.csdn.net/fengtingYan/article/details/88576067