84669 人が学習中
152542 人が学習中
20005 人が学習中
5487 人が学習中
7821 人が学習中
359900 人が学習中
3350 人が学習中
180660 人が学習中
48569 人が学習中
18603 人が学習中
40936 人が学習中
1549 人が学習中
1183 人が学習中
32909 人が学習中
现在项目中有一个撒花功能,因为表单提交是分多个页面跳转选项的,我想设置一个localstorage可以多个页面共用,且记录当前的表单的value值。
localStorage本来就是全局的,在哪都能用,不用考虑多页面了。楼上方法很标准!!
给表单设置一个父路由,将共用的数据模型绑定到父路由上。
用localstorage的话,就记录下再跳转呗,也存一个对象
localStorage.setItem('key', JSON.stringify(obj)); localStorage.getItem('key', JSON.parse(obj));
localStorage本来就是全局的,在哪都能用,不用考虑多页面了。楼上方法很标准!!
给表单设置一个父路由,将共用的数据模型绑定到父路由上。
用localstorage的话,就记录下再跳转呗,也存一个对象