vuejs win color bsp .get urn str ejs
- const STORAGE_KEY = 'todos - vuejs' //定义常量保存键值
- export
- default {
- fetch() {
- return JSON.parse(window.localStorage.getItem(STORAGE_KEY) || ' []');
- },
- save(items) {
- window.localStorage.setItem(STORAGE_KEY, JSON.stringify(items))
- }
- }
vue 使用 localStorage 保存页面变量到浏览器变量中
来源: http://www.bubuko.com/infodetail-2140029.html