JSON.stringify

const STORAGE_KEY = 'todos-vaejs'

export default {

fetch: function(){

return JSON.parse(window.localStorage.getItem(STORAGE_KEY) || '[]')

},

save: function(items){

window.localStorage.setItem(STORAGE_KEY, JSON.stringify(items))

}

}




错误提示


[HMR] bundle has 1 errors

client.js?7955:161./src/store.js

Module not found: Error: Can't resolve 'babel-runtime/core-js/json/stringify' in 'G:\vue\sell\src'

 @ ./src/store.js 1:0-67

 @ ./~/babel-loader/lib!./~/vue-loader/lib/selector.js?type=script&index=0!./src/components/Hello.vue

 @ ./src/components/Hello.vue

 @ ./src/router/index.js

 @ ./src/main.js

 @ multi ./build/dev-client ./src/main.js


Show_0005
浏览 2032回答 1
1回答

new_object_

读报错信息,安装babel-runtimenpm install babel-runtime
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

Vue.js