lesson 16 functions

This commit is contained in:
Andreas Zweili 2021-01-18 16:22:14 +01:00
parent a16a00bce3
commit b34a75e338
2 changed files with 11 additions and 1 deletions

View File

@ -7,6 +7,16 @@ const app = Vue.createApp({
vueLink: "https://vuejs.org", vueLink: "https://vuejs.org",
}; };
}, },
methods: {
outputGoal() {
const randomNumber = Math.random();
if (randomNumber < 0.5) {
return "Learn Vue!";
} else {
return "Master Vue!";
}
},
},
}); });
app.mount("#user-goal"); app.mount("#user-goal");

View File

@ -17,7 +17,7 @@
</header> </header>
<section id="user-goal"> <section id="user-goal">
<h2>My Course Goal</h2> <h2>My Course Goal</h2>
<p>{{ courseGoal }}</p> <p>{{ outputGoal() }}</p>
<p>Learn more <a v-bind:href="vueLink">about Vue</a>.</p> <p>Learn more <a v-bind:href="vueLink">about Vue</a>.</p>
</section> </section>
</body> </body>