Session 3

main
marcgauch 2023-01-18 21:58:07 +01:00
parent c335f5a31f
commit 65869fbe87
20 changed files with 2750 additions and 0 deletions

28
session-3/exam-advanced/.gitignore vendored Normal file
View File

@ -0,0 +1,28 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
lerna-debug.log*
node_modules
.DS_Store
dist
dist-ssr
coverage
*.local
/cypress/videos/
/cypress/screenshots/
# Editor directories and files
.vscode/*
!.vscode/extensions.json
.idea
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?

View File

@ -0,0 +1,3 @@
{
"recommendations": ["Vue.volar", "Vue.vscode-typescript-vue-plugin"]
}

View File

@ -0,0 +1,29 @@
# exam
This template should help get you started developing with Vue 3 in Vite.
## Recommended IDE Setup
[VSCode](https://code.visualstudio.com/) + [Volar](https://marketplace.visualstudio.com/items?itemName=Vue.volar) (and disable Vetur) + [TypeScript Vue Plugin (Volar)](https://marketplace.visualstudio.com/items?itemName=Vue.vscode-typescript-vue-plugin).
## Customize configuration
See [Vite Configuration Reference](https://vitejs.dev/config/).
## Project Setup
```sh
npm install
```
### Compile and Hot-Reload for Development
```sh
npm run dev
```
### Compile and Minify for Production
```sh
npm run build
```

View File

@ -0,0 +1,13 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<link rel="stylesheet" href="https://unpkg.com/chota@latest">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Exam App</title>
</head>
<body>
<div id="app"></div>
<script type="module" src="/src/main.js"></script>
</body>
</html>

1205
session-3/exam-advanced/package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,17 @@
{
"name": "exam",
"version": "0.0.0",
"private": true,
"scripts": {
"dev": "vite",
"build": "vite build",
"preview": "vite preview"
},
"dependencies": {
"vue": "^3.2.45"
},
"devDependencies": {
"@vitejs/plugin-vue": "^3.2.0",
"vite": "^3.2.4"
}
}

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>

View File

@ -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>

View File

@ -0,0 +1,5 @@
import { createApp } from "vue";
import App from "./App.vue";
const app = createApp(App);
app.mount("#app");

View File

@ -0,0 +1,14 @@
import { fileURLToPath, URL } from 'node:url'
import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
// https://vitejs.dev/config/
export default defineConfig({
plugins: [vue()],
resolve: {
alias: {
'@': fileURLToPath(new URL('./src', import.meta.url))
}
}
})

28
session-3/exam/.gitignore vendored Normal file
View File

@ -0,0 +1,28 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
lerna-debug.log*
node_modules
.DS_Store
dist
dist-ssr
coverage
*.local
/cypress/videos/
/cypress/screenshots/
# Editor directories and files
.vscode/*
!.vscode/extensions.json
.idea
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?

View File

@ -0,0 +1,3 @@
{
"recommendations": ["Vue.volar", "Vue.vscode-typescript-vue-plugin"]
}

29
session-3/exam/README.md Normal file
View File

@ -0,0 +1,29 @@
# exam
This template should help get you started developing with Vue 3 in Vite.
## Recommended IDE Setup
[VSCode](https://code.visualstudio.com/) + [Volar](https://marketplace.visualstudio.com/items?itemName=Vue.volar) (and disable Vetur) + [TypeScript Vue Plugin (Volar)](https://marketplace.visualstudio.com/items?itemName=Vue.vscode-typescript-vue-plugin).
## Customize configuration
See [Vite Configuration Reference](https://vitejs.dev/config/).
## Project Setup
```sh
npm install
```
### Compile and Hot-Reload for Development
```sh
npm run dev
```
### Compile and Minify for Production
```sh
npm run build
```

13
session-3/exam/index.html Normal file
View File

@ -0,0 +1,13 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<link rel="stylesheet" href="https://unpkg.com/chota@latest">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Exam App</title>
</head>
<body>
<div id="app"></div>
<script type="module" src="/src/main.js"></script>
</body>
</html>

1205
session-3/exam/package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,17 @@
{
"name": "exam",
"version": "0.0.0",
"private": true,
"scripts": {
"dev": "vite",
"build": "vite build",
"preview": "vite preview"
},
"dependencies": {
"vue": "^3.2.45"
},
"devDependencies": {
"@vitejs/plugin-vue": "^3.2.0",
"vite": "^3.2.4"
}
}

View File

@ -0,0 +1,34 @@
<!--
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">
<Articles header="Winter is coming!" text="Get your gear ready." />
</div>
<div class="col">
<Articles header="Vue.js" text="Version 14 out now!" />
</div>
<div class="col">
<Articles header="Chur" text="Swiss town out of Cheese!" />
</div>
<div class="col">
<Articles header="FHGR" text="Data leaked from University." />
</div>
</div>
</section>
</template>
<script>
import Articles from "./components/Articles.vue";
export default {
components: {
Articles,
},
};
</script>

View File

@ -0,0 +1,14 @@
<template>
<div class="card">
<header>
<h4>{{ header }}</h4>
</header>
<p>{{ text }}</p>
</div>
</template>
<script>
export default {
props: ["header", "text"],
};
</script>

View File

@ -0,0 +1,5 @@
import { createApp } from "vue";
import App from "./App.vue";
const app = createApp(App);
app.mount("#app");

View File

@ -0,0 +1,14 @@
import { fileURLToPath, URL } from 'node:url'
import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
// https://vitejs.dev/config/
export default defineConfig({
plugins: [vue()],
resolve: {
alias: {
'@': fileURLToPath(new URL('./src', import.meta.url))
}
}
})