存储数据

var comment = {id:Date.now(),user:this.user,content:this.content}
var list = JSON.parse(localStorage.getItem('cmts')||'[]')
list.unshift(comment)
localStorage.setItem('cmts',JSON.stringify(list))
this.user=this.content=' '
posted @ 2020-09-02 12:37  廿廿廿廿  阅读(81)  评论(0)    收藏  举报