Session 3

This commit is contained in:
marcgauch committed 2023-01-18 21:58:07 +01:00
1 parent c335f5a31f
commit 65869fbe87
20 files changed
+2750

No files matched your search

+39
View File
@@ -0,0 +1,39 @@
<!--
Task: Outsource the "Articles" from this News Site in a child component including Props
for the header and Paragraph Text.
The data for this Articles should come from the Parent SFC.
-->
<template>
<section class="container" id="app">
<h1>News of the day</h1>
<div class="row">
<div class="col" v-for="article in articles">
<Articles :header="article.header" :text="article.text" />
</div>
</div>
</section>
</template>
<script>
import Articles from "./components/Articles.vue";
export default {
data() {
return {
articles: [
{ header: "Winter is coming!", text: "Get your gear ready." },
{ header: "Vue.js", text: "Version 14 out now!" },
{ header: "Chur", text: "Swiss town out of Cheese!" },
{ header: "FHGR", text: "Data leaked from University." },
{
header: "marc",
text: "hat auch noch was wichtiges was er sagen möchte.",
},
],
};
},
components: {
Articles,
},
};
</script>
@@ -0,0 +1,35 @@
<template>
<div class="card" :class="{ red: binIchGelesen }">
<!-- <div class="card" :class="state"></div> ez way-->
<header>
<h4>{{ header }}</h4>
</header>
<p>{{ text }}</p>
<button @click="showAlert">vorlesen</button>
</div>
</template>
<script>
export default {
props: ["header", "text"],
data() {
return {
binIchGelesen: false,
//state: "", // das hier auf red setzen ist der easy way
};
},
methods: {
showAlert() {
alert(this.header);
this.binIchGelesen = true;
//this.state = "red"; // ez way
},
},
};
</script>
<style>
.red {
background-color: red;
}
</style>
+5
View File
@@ -0,0 +1,5 @@
import { createApp } from "vue";
import App from "./App.vue";
const app = createApp(App);
app.mount("#app");