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-20 lists-cond-assig.../app.js

31 lines
604 B
JavaScript

"use strict";
const app = Vue.createApp({
data() {
return {
tasks: [],
newTask: "",
showTasks: true,
};
},
computed: {
buttonText() {
if (this.showTasks) {
return "Hide Tasks";
} else if (!this.showTasks) {
return "Show Tasks";
}
},
},
methods: {
addTask(newTask) {
this.tasks.push(this.newTask);
},
toggleTasks() {
this.showTasks = !this.showTasks;
},
},
});
app.mount("#assignment");