-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.js
36 lines (30 loc) · 975 Bytes
/
app.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
const STORAGE_KEY = 'Tasks';
const $ = document.querySelector.bind(document);
const addButton = $('.add-task.button');
const deleteAllButton = $('.delete-all');
const taskList = $('.task-list');
const taskNameInput = $('.task-name input');
let allTasks = [];
//Task class
class Task {
constructor(id, name, trashed) {
this.id = id;
this.name = name;
this.trashed = trashed;
}
}
//Add new task with user clicks add button
addButton.addEventListener('click', function () {
if (taskNameInput.value !== '') {
addTask();
}
});
var addButton = new Vue ({
})
//Task Component
Vue.component('task', {
template: `<div class="task odd"><span>${task.name}</span><div class="actions"><input class="trashed" id="checkBox" data-trashed-task-id="${task.id}" type="checkbox"><button class="delete button" type="button" data-delete-task-id="${task.id}">Delete</button></div></div>`
})
var task = new Vue({
el: '.task-list',
})