ADD file via upload

pgqsfrmjb 1 year ago
parent e8de1a5676
commit 66e764c15a

@ -0,0 +1,47 @@
const { createApp } = Vue;
createApp({
data() {
return {
newTask: '',
tasks:[
{ name: 'Learn Vue', completed: false },
{ name: 'Create a Vue project with the CLI', completed: true },
],
editingIndex: null,
editingTask: '',
}
},
computed: {
completedCount() {
return this.tasks.filter(task => task.completed === true).length;
}
},
methods: {
addTask(){
if (this.newTask.trim() !== '') {
this.tasks.push({ name: this.newTask, completed: false });
this.newTask = '';
}
},
editTask(index) {
this.editingIndex = index;
this.editingTask = this.tasks[index].name;
},
cancelEdit() {
this.editingIndex = null;
this.editingTask = '';
},
saveEdit(index) {
if(this.editingTask.trim() !== ''){
this.tasks[index].name = this.editingTask;
this.cancelEdit();
}
},
deleteTask(index) {
this.tasks.splice(index, 1);
},
completeTask(index) {
this.tasks[index].completed = true;
}
}
}).mount('#app');
Loading…
Cancel
Save