0
点赞
收藏
分享

微信扫一扫

toDoList的做法


toDoList的做法_数据存储

toDoList的做法_数据存储_02

toDoList的做法_jquery_03

以下部分实现了将数据存储到本地的操作

toDoList的做法_jquery_04

读取和存储本地数据的方法

function getDate() {
var data = localStorage.getItem("todolist");
if (data !== null) {
// 本地存储里面的数据是字符串格式的 但是我们需要的是对象格式的
return JSON.parse(data);
} else {
return [];
}
}

toDoList的做法_数据_05

以下是将本地数据渲染加载到网页页面

toDoList的做法_数据_06

toDoList的做法_jquery_07

toDoList的做法_赋值_08

以下是删除操作

toDoList的做法_赋值_09

数组中删除元素的方法

toDoList的做法_数据存储_10

修改相应的done属性的方法

toDoList的做法_数据_11

toDoList的做法_jquery_12

toDoList的做法_赋值_13

注意:第三个框的意思是将input的固有属性checked赋值给相应的done作为修改值,即修改为true。



举报

相关推荐

0 条评论