vue2.0+vuex+localStorage 待办事项源码:
代码预览
vuex官方文档 nofollow" target="_blank" href="https://vuex.vuejs.org/">https://vuex.vuejs.org/ 我觉的官方文档说明很详细
localStorage 用来本地储存数据
export default state
types.SET_SHIXIANG{
state.home.push(data)
localStorage.setItem("home",JSON.stringify(state.home));
},types.SET_YES{
state.item.push(data)
localStorage.setItem("item",JSON.stringify(state.item));
}
}
state.home.push(data)
localStorage.setItem("home",JSON.stringify(state.home));
},types.SET_YES{
state.item.push(data)
localStorage.setItem("item",JSON.stringify(state.item));
}
}
export default mutations
项目截图
项目运行
serve with hot reload at localhost:8080
原文链接:https://www.f2er.com/vue/32079.htmlnpm run dev
build for production with minification
npm run build