This repository has been archived on 2021-09-06. You can view files and clone it, but cannot push or open issues or pull requests.
vuejs_course/2021-01-13 gs-01-starting-p.../gs-01-starting-project/app.js

33 lines
794 B
JavaScript

"use strict";
Vue.createApp({
data() {
return {
goals: [],
enteredValue: "",
};
},
methods: {
addGoal() {
if (this.enteredValue !== "") {
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);