Skip to content

Commit ebe3e90

Browse files
committed
delete item
1 parent a885949 commit ebe3e90

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

src/detail/detail.js

+3
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,9 @@ export default {
5555
history.go(-1);
5656
}).on('click', '#delete', function () {
5757
$.weui.confirm('确定要删除改任务 ?', function () {
58+
const id = router.params.id;
59+
const todos = dataManager.getData(dataManager.TODOS, []);
60+
let todo = todos.filter(todo => todo.id == id)[0];
5861
util.debug('确定删除');
5962
dataManager.setData(dataManager.TODOS, util.removeFromArray(todos, todo));
6063
history.go(-1);

src/lib/api/api.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ export default {
88
const todos = localStorage.getItem(this.TODOS);
99
setTimeout(() => {
1010
resolve(JSON.parse(todos));
11-
}, 1000);
11+
}, 500);
1212
});
1313
},
1414
write(obj){

0 commit comments

Comments
 (0)