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
| Vue.createApp({
| data() {
| return {
| goals: [],
| enteredValue: "",
| };
| },
| methods: {
| addGoal() {
| this.goals.push(this.enteredValue);
| this.enteredValue = "";
| },
| },
| }).mount("#app");
|
| // const buttonEl= document.querySelector('button');
| // const inputEl= document.querySelector('input');
| // const listEl = document.querySelector('ul');
|
| // function addGoal(){
| // const enteredValue = inputEl.value;
| // const listItemEl = document.createElement('li');
| // listItemEl.textContent = enteredValue;
| // listEl.appendChild(listItemEl);
| // inputEl.value = "";
| // }
|
| // buttonEl.addEventListener('click', addGoal);
|
|