第四周小组作业

本次作业由小组四人合力完成:

  • 产品:程林可
  • 前端:熊洋
  • 后端:于毅仁、李景琦

小程序:TODO LIST

源码如下

  • :Todo list小程序
    Js:
    Page({

    data:{
    tasks:[],
    newTask:'',
    key:0
    },
    changeTaskStatus: function(e){
    let value = e.currentTarget.dataset.value;

    let tasks = this.data.tasks;

    let index = tasks.findIndex(task => task.value == value);

    if (index<0){
    return;
    }

    tasks[index].status = !tasks[index].status;

    this.setData({
    tasks : tasks
    });
    },
    removeTask: function(e){
    let value = e.currentTarget.dataset.value;

     let tasks = this.data.tasks;
    
     let newTasks = tasks.filter(task => task.value != value);
    
     this.setData({
    tasks : newTasks
    

    });
    },
    typeNewTask: function(e){
    this.setData({
    newTask: e.detail.value.trim()
    });
    },

    addTask: function(){
    let tasks = this.data.tasks;

    let key = this.data.key;

    let newTaskObj={content: this.data.newTask,value: key++,status: false};

    tasks.push(newTaskObj);

    this.setData({
    tasks: tasks,
    key: key,
    newTask:''
    });
    },
    })

Json:
{
"navigationBarBackgroundColor": "#ffffff",
"navigationBarTextStyle": "black",
"navigationBarTitleText": "Todo List",
"backgroundColor": "#eeeeee",
"backgroundTextStyle": "light"
}
Qml:







    待办事项
    
        
            
        
    



Qss:
.userinfo {
display: flex;
flex-direction: column;
align-items: center;
}

.userinfo-avatar {
width: 128rpx;
height: 128rpx;
margin: 20rpx;
border-radius: 50%;
}

.userinfo-nickname {
color: #aaa;
}

.usermotto {
margin-top: 200px;
}

附:本次小程序大赛产品mvp
产品.png

你可能感兴趣的:(第四周小组作业)