12345678910111213141516171819202122232425262728293031323334353637383940414243 |
- // index.js
- // 获取应用实例
- const app = getApp();
- Page({
- data: {
- todolist: [{
- id: 1,
- title: '吃饭',
- done: true
- },
- {
- id: 2,
- title: '睡觉',
- done: false
- }
- ]
- },
- onTap(ev) {
- console.log("你敢点我???");
- // console.log(ev)
- },
- async onRemoveTodo(e) {
- // console.log('你要删除该代办吗?', e)
- let res = await wx.showModal({
- title: '确认删除',
- content: '确定删除当前代办吗?',
- cancelText: 'NO',
- confirmText: 'YES',
- confirmColor: '#8B1A1A',
- cancelColor: '#4169E1'
- })
- if (res.cancel) return;
- const delId = e.target.dataset.id
- this.setData({
- todolist: this.data.todolist.filter(todo => todo.id !== delId)
- })
- }
- });
|