Entwicklung von digitalen Produkten der nächsten Ebene

data() {
return {
title: 'My Vue App',
items: [] as Array<{ id: number; name: string; }>,
};
},
mounted() {
this.loadItems();
},
methods: {
async loadItems() {
const data = await fetch('/api/items');
this.items = await data.json();
},
addItem() {
const newItem = {
id: this.items.length + 1,
name: `Item ${this.items.length + 1}`,
};
this.items.push(newItem);
},
removeItem(id: number) {
this.items = this.items.filter(item => item.id !== id);
},
updateTitle() {
this.title = 'Updated Title';
},
clearItems() {
this.items = [];
},
sortItems() {
this.items.sort((a, b) => a.name.localeCompare(b.name));
},
reverseItems() {
this.items.reverse();
},
duplicateItems() {
this.items = [...this.items, ...this.items];
},
fetchMoreItems() {
// Fetch more items and add to the list
},
logItemCount() {
console.log(`Item count: ${this.items.length}`);
}
}
interface Vehicle {
make: string;
model: string;
year: number;
start(): void;
stop(): void;
}
interface ElectricVehicle extends Vehicle {
batteryLevel: number;
charge(): void;
}
class Car implements Vehicle {
constructor(public make: string, public model: string, public year: number) {}
start() {
console.log(`${this.make} ${this.model} is starting...`);
}
stop() {
console.log(`${this.make} ${this.model} is stopping...`);
}
}
class ElectricCar extends Car implements ElectricVehicle {
batteryLevel: number;
constructor(make: string, model: string, year: number, batteryLevel: number) {
super(make, model, year);
this.batteryLevel = batteryLevel;
}
charge() {
console.log('Charging...');
this.batteryLevel = 100;
}
}
const myCar = new Car('Toyota', 'Corolla', 2021);
myCar.start();
myCar.stop();
const myElectricCar = new ElectricCar('Tesla', 'Model S', 2021, 50);
myElectricCar.start();
myElectricCar.stop();
myElectricCar.charge();
function showBatteryLevel(car: ElectricVehicle) {
console.log(`Battery Level: ${car.batteryLevel}%`);
}
showBatteryLevel(myElectricCar);
data() {
return {
title: 'My Vue App',
items: [] as Array<{ id: number; name: string; }>,
};
},
mounted() {
this.loadItems();
},
methods: {
async loadItems() {
const data = await fetch('/api/items');
this.items = await data.json();
},
addItem() {
const newItem = {
id: this.items.length + 1,
name: `Item ${this.items.length + 1}`,
};
this.items.push(newItem);
},
removeItem(id: number) {
this.items = this.items.filter(item => item.id !== id);
},
updateTitle() {
this.title = 'Updated Title';
},
clearItems() {
this.items = [];
},
sortItems() {
this.items.sort((a, b) => a.name.localeCompare(b.name));
},
reverseItems() {
this.items.reverse();
},
duplicateItems() {
this.items = [...this.items, ...this.items];
},
fetchMoreItems() {
// Fetch more items and add to the list
},
logItemCount() {
console.log(`Item count: ${this.items.length}`);
}
}
<div class='container'>
<div class='header'>
<h1>{{ title }}</h1>
</div>
<div class='content'>
<div v-for='item in items' :key='item.id' class='card'>
<div class='card-header'>
{{ item.title }}
</div>
<div class='card-content'>
{{ item.description }}
</div>
<button @click='removeItem(item.id)' class='button'>
Remove
</button>
</div>
</div>
<div class='footer'>
<button @click='addItem' class='button'>
Add Item
</button>
</div>
<div class='modal' v-if='showModal'>
<div class='modal-content'>
<h2>Are you sure?</h2>
<button @click='confirm' class='button'>
Yes
</button>
<button @click='cancel' class='button'>
No
</button>
</div>
</div>
<div class='pagination'>
<button @click='prevPage' class='button' :disabled='currentPage <= 1'>
Prev
</button>
<span>{{ currentPage }}</span>
<button @click='nextPage' class='button' :disabled='currentPage >= totalPages'>
Next
</button>
</div>
</div>
import { ref, onMounted, computed } from 'vue';
const title = ref('My Vue App');
const items = ref([]);
const showModal = ref(false);
const currentPage = ref(1);
const itemsPerPage = ref(10);
onMounted(async () => {
const data = await fetch('/api/items');
items.value = await data.json();
});
const totalPages = computed(() => {
return Math.ceil(items.value.length / itemsPerPage.value);
});
const addItem = () => {
const newItem = {
id: items.value.length + 1,
title: `Item ${items.value.length + 1}`,
description: 'This is a description.',
};
items.value.push(newItem);
};
const removeItem = (id) => {
items.value = items.value.filter(item => item.id !== id);
};
const nextPage = () => {
if (currentPage.value < totalPages.value) {
currentPage.value++;
}
};
const prevPage = () => {
if (currentPage.value > 1) {
currentPage.value--;
}
};
const confirm = () => {
showModal.value = false;
// Perform some action
};
const cancel = () => {
showModal.value = false;
};
const fetchMoreItems = async () => {
const data = await fetch(`/api/items?page=${currentPage.value}`);
const newItems = await data.json();
items.value = [...items.value, ...newItems];
};
import { SomeClass } from './some-module';
interface Person {
name: string;
age: number;
}
class MyClass {
private data: T[] = [];
constructor() {
// Initialize
}
add(item: T) {
this.data.push(item);
}
remove(index: number) {
this.data.splice(index, 1);
}
getAll(): T[] {
return this.data;
}
}
function delay(ms: number): Promise {
return new Promise(resolve => setTimeout(resolve, ms));
}
async function fetchData(): Promise<string[]> {
await delay(1000);
return ['data1', 'data2', 'data3'];
}
const person: Person = {
name: 'John Doe',
age: 30,
};
const myClassInstance = new MyClass ();
myClassInstance.add(10);
myClassInstance.add(20);
myClassInstance.remove(0);
const allData = myClassInstance.getAll();
fetchData().then(data => {
console.log(data);
});
console.log(person.name);
console.log(person.age);
body {
font-family: Arial, sans-serif;
background-color: #f2f2f2;
}
h1 {
color: #333333;
font-size: 24px;
margin-bottom: 10px;
}
.container {
width: 100%;
max-width: 1200px;
margin: 0 auto;
padding: 20px;
}
.button {
display: inline-block;
padding: 10px 20px;
background-color: #007bff;
color: #ffffff;
text-decoration: none;
border-radius: 4px;
transition: background-color 0.3s ease;
}
.button:hover {
background-color: #0056b3;
}
.card {
background-color: #ffffff;
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
padding: 20px;
margin-bottom: 20px;
}
.form-group {
margin-bottom: 10px;
}
.input-field {
width: 100%;
padding: 10px;
border: 1px solid #cccccc;
border-radius: 4px;
}
.error-message {
color: #ff0000;
font-size: 14px;
}
import { ref, onMounted, computed } from 'vue';
import axios from 'axios';
const title = ref('My Vue App');
const items = ref([]);
const showModal = ref(false);
const currentPage = ref(1);
const itemsPerPage = ref(10);
const totalPages = computed(() => {
return Math.ceil(items.value.length / itemsPerPage.value);
});
const fetchItems = async () => {
const response = await axios.get('/api/items');
items.value = response.data;
};
const addItem = () => {
const newItem = {
id: items.value.length + 1,
title: `Item ${items.value.length + 1}`,
description: 'This is a description.'
};
items.value.push(newItem);
};
const removeItem = (id) => {
items.value = items.value.filter(item => item.id !== id);
};
const nextPage = () => {
if (currentPage.value < totalPages.value) {
currentPage.value++;
}
};
const prevPage = () => {
if (currentPage.value > 1) {
currentPage.value--;
}
};
const confirmModal = () => {
showModal.value = false;
// Perform some action
};
const cancelModal = () => {
showModal.value = false;
};
onMounted(() => {
fetchItems();
});
data() {
return {
title: 'My Vue App',
items: [] as Array<{ id: number; name: string; }>,
};
},
mounted() {
this.loadItems();
},
methods: {
async loadItems() {
const data = await fetch('/api/items');
this.items = await data.json();
},
addItem() {
const newItem = {
id: this.items.length + 1,
name: `Item ${this.items.length + 1}`,
};
this.items.push(newItem);
},
removeItem(id: number) {
this.items = this.items.filter(item => item.id !== id);
},
updateTitle() {
this.title = 'Updated Title';
},
clearItems() {
this.items = [];
},
sortItems() {
this.items.sort((a, b) => a.name.localeCompare(b.name));
},
reverseItems() {
this.items.reverse();
},
duplicateItems() {
this.items = [...this.items, ...this.items];
},
fetchMoreItems() {
// Fetch more items and add to the list
},
logItemCount() {
console.log(`Item count: ${this.items.length}`);
}
}
data() {
return {
title: 'My Vue App',
items: [] as Array<{ id: number; name: string; }>,
};
},
mounted() {
this.loadItems();
},
methods: {
async loadItems() {
const data = await fetch('/api/items');
this.items = await data.json();
},
addItem() {
const newItem = {
id: this.items.length + 1,
name: `Item ${this.items.length + 1}`,
};
this.items.push(newItem);
},
removeItem(id: number) {
this.items = this.items.filter(item => item.id !== id);
},
updateTitle() {
this.title = 'Updated Title';
},
clearItems() {
this.items = [];
},
sortItems() {
this.items.sort((a, b) => a.name.localeCompare(b.name));
},
reverseItems() {
this.items.reverse();
},
duplicateItems() {
this.items = [...this.items, ...this.items];
},
fetchMoreItems() {
// Fetch more items and add to the list
},
logItemCount() {
console.log(`Item count: ${this.items.length}`);
}
}
interface Vehicle {
make: string;
model: string;
year: number;
start(): void;
stop(): void;
}
interface ElectricVehicle extends Vehicle {
batteryLevel: number;
charge(): void;
}
class Car implements Vehicle {
constructor(public make: string, public model: string, public year: number) {}
start() {
console.log(`${this.make} ${this.model} is starting...`);
}
stop() {
console.log(`${this.make} ${this.model} is stopping...`);
}
}
class ElectricCar extends Car implements ElectricVehicle {
batteryLevel: number;
constructor(make: string, model: string, year: number, batteryLevel: number) {
super(make, model, year);
this.batteryLevel = batteryLevel;
}
charge() {
console.log('Charging...');
this.batteryLevel = 100;
}
}
const myCar = new Car('Toyota', 'Corolla', 2021);
myCar.start();
myCar.stop();
const myElectricCar = new ElectricCar('Tesla', 'Model S', 2021, 50);
myElectricCar.start();
myElectricCar.stop();
myElectricCar.charge();
function showBatteryLevel(car: ElectricVehicle) {
console.log(`Battery Level: ${car.batteryLevel}%`);
}
showBatteryLevel(myElectricCar);
data() {
return {
title: 'My Vue App',
items: [] as Array<{ id: number; name: string; }>,
};
},
mounted() {
this.loadItems();
},
methods: {
async loadItems() {
const data = await fetch('/api/items');
this.items = await data.json();
},
addItem() {
const newItem = {
id: this.items.length + 1,
name: `Item ${this.items.length + 1}`,
};
this.items.push(newItem);
},
removeItem(id: number) {
this.items = this.items.filter(item => item.id !== id);
},
updateTitle() {
this.title = 'Updated Title';
},
clearItems() {
this.items = [];
},
sortItems() {
this.items.sort((a, b) => a.name.localeCompare(b.name));
},
reverseItems() {
this.items.reverse();
},
duplicateItems() {
this.items = [...this.items, ...this.items];
},
fetchMoreItems() {
// Fetch more items and add to the list
},
logItemCount() {
console.log(`Item count: ${this.items.length}`);
}
}
<div class='container'>
<div class='header'>
<h1>{{ title }}</h1>
</div>
<div class='content'>
<div v-for='item in items' :key='item.id' class='card'>
<div class='card-header'>
{{ item.title }}
</div>
<div class='card-content'>
{{ item.description }}
</div>
<button @click='removeItem(item.id)' class='button'>
Remove
</button>
</div>
</div>
<div class='footer'>
<button @click='addItem' class='button'>
Add Item
</button>
</div>
<div class='modal' v-if='showModal'>
<div class='modal-content'>
<h2>Are you sure?</h2>
<button @click='confirm' class='button'>
Yes
</button>
<button @click='cancel' class='button'>
No
</button>
</div>
</div>
<div class='pagination'>
<button @click='prevPage' class='button' :disabled='currentPage <= 1'>
Prev
</button>
<span>{{ currentPage }}</span>
<button @click='nextPage' class='button' :disabled='currentPage >= totalPages'>
Next
</button>
</div>
</div>
import { ref, onMounted, computed } from 'vue';
const title = ref('My Vue App');
const items = ref([]);
const showModal = ref(false);
const currentPage = ref(1);
const itemsPerPage = ref(10);
onMounted(async () => {
const data = await fetch('/api/items');
items.value = await data.json();
});
const totalPages = computed(() => {
return Math.ceil(items.value.length / itemsPerPage.value);
});
const addItem = () => {
const newItem = {
id: items.value.length + 1,
title: `Item ${items.value.length + 1}`,
description: 'This is a description.',
};
items.value.push(newItem);
};
const removeItem = (id) => {
items.value = items.value.filter(item => item.id !== id);
};
const nextPage = () => {
if (currentPage.value < totalPages.value) {
currentPage.value++;
}
};
const prevPage = () => {
if (currentPage.value > 1) {
currentPage.value--;
}
};
const confirm = () => {
showModal.value = false;
// Perform some action
};
const cancel = () => {
showModal.value = false;
};
const fetchMoreItems = async () => {
const data = await fetch(`/api/items?page=${currentPage.value}`);
const newItems = await data.json();
items.value = [...items.value, ...newItems];
};
import { SomeClass } from './some-module';
interface Person {
name: string;
age: number;
}
class MyClass {
private data: T[] = [];
constructor() {
// Initialize
}
add(item: T) {
this.data.push(item);
}
remove(index: number) {
this.data.splice(index, 1);
}
getAll(): T[] {
return this.data;
}
}
function delay(ms: number): Promise {
return new Promise(resolve => setTimeout(resolve, ms));
}
async function fetchData(): Promise<string[]> {
await delay(1000);
return ['data1', 'data2', 'data3'];
}
const person: Person = {
name: 'John Doe',
age: 30,
};
const myClassInstance = new MyClass ();
myClassInstance.add(10);
myClassInstance.add(20);
myClassInstance.remove(0);
const allData = myClassInstance.getAll();
fetchData().then(data => {
console.log(data);
});
console.log(person.name);
console.log(person.age);
body {
font-family: Arial, sans-serif;
background-color: #f2f2f2;
}
h1 {
color: #333333;
font-size: 24px;
margin-bottom: 10px;
}
.container {
width: 100%;
max-width: 1200px;
margin: 0 auto;
padding: 20px;
}
.button {
display: inline-block;
padding: 10px 20px;
background-color: #007bff;
color: #ffffff;
text-decoration: none;
border-radius: 4px;
transition: background-color 0.3s ease;
}
.button:hover {
background-color: #0056b3;
}
.card {
background-color: #ffffff;
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
padding: 20px;
margin-bottom: 20px;
}
.form-group {
margin-bottom: 10px;
}
.input-field {
width: 100%;
padding: 10px;
border: 1px solid #cccccc;
border-radius: 4px;
}
.error-message {
color: #ff0000;
font-size: 14px;
}
import { ref, onMounted, computed } from 'vue';
import axios from 'axios';
const title = ref('My Vue App');
const items = ref([]);
const showModal = ref(false);
const currentPage = ref(1);
const itemsPerPage = ref(10);
const totalPages = computed(() => {
return Math.ceil(items.value.length / itemsPerPage.value);
});
const fetchItems = async () => {
const response = await axios.get('/api/items');
items.value = response.data;
};
const addItem = () => {
const newItem = {
id: items.value.length + 1,
title: `Item ${items.value.length + 1}`,
description: 'This is a description.'
};
items.value.push(newItem);
};
const removeItem = (id) => {
items.value = items.value.filter(item => item.id !== id);
};
const nextPage = () => {
if (currentPage.value < totalPages.value) {
currentPage.value++;
}
};
const prevPage = () => {
if (currentPage.value > 1) {
currentPage.value--;
}
};
const confirmModal = () => {
showModal.value = false;
// Perform some action
};
const cancelModal = () => {
showModal.value = false;
};
onMounted(() => {
fetchItems();
});
data() {
return {
title: 'My Vue App',
items: [] as Array<{ id: number; name: string; }>,
};
},
mounted() {
this.loadItems();
},
methods: {
async loadItems() {
const data = await fetch('/api/items');
this.items = await data.json();
},
addItem() {
const newItem = {
id: this.items.length + 1,
name: `Item ${this.items.length + 1}`,
};
this.items.push(newItem);
},
removeItem(id: number) {
this.items = this.items.filter(item => item.id !== id);
},
updateTitle() {
this.title = 'Updated Title';
},
clearItems() {
this.items = [];
},
sortItems() {
this.items.sort((a, b) => a.name.localeCompare(b.name));
},
reverseItems() {
this.items.reverse();
},
duplicateItems() {
this.items = [...this.items, ...this.items];
},
fetchMoreItems() {
// Fetch more items and add to the list
},
logItemCount() {
console.log(`Item count: ${this.items.length}`);
}
}
data() {
return {
title: 'My Vue App',
items: [] as Array<{ id: number; name: string; }>,
};
},
mounted() {
this.loadItems();
},
methods: {
async loadItems() {
const data = await fetch('/api/items');
this.items = await data.json();
},
addItem() {
const newItem = {
id: this.items.length + 1,
name: `Item ${this.items.length + 1}`,
};
this.items.push(newItem);
},
removeItem(id: number) {
this.items = this.items.filter(item => item.id !== id);
},
updateTitle() {
this.title = 'Updated Title';
},
clearItems() {
this.items = [];
},
sortItems() {
this.items.sort((a, b) => a.name.localeCompare(b.name));
},
reverseItems() {
this.items.reverse();
},
duplicateItems() {
this.items = [...this.items, ...this.items];
},
fetchMoreItems() {
// Fetch more items and add to the list
},
logItemCount() {
console.log(`Item count: ${this.items.length}`);
}
}
interface Vehicle {
make: string;
model: string;
year: number;
start(): void;
stop(): void;
}
interface ElectricVehicle extends Vehicle {
batteryLevel: number;
charge(): void;
}
class Car implements Vehicle {
constructor(public make: string, public model: string, public year: number) {}
start() {
console.log(`${this.make} ${this.model} is starting...`);
}
stop() {
console.log(`${this.make} ${this.model} is stopping...`);
}
}
class ElectricCar extends Car implements ElectricVehicle {
batteryLevel: number;
constructor(make: string, model: string, year: number, batteryLevel: number) {
super(make, model, year);
this.batteryLevel = batteryLevel;
}
charge() {
console.log('Charging...');
this.batteryLevel = 100;
}
}
const myCar = new Car('Toyota', 'Corolla', 2021);
myCar.start();
myCar.stop();
const myElectricCar = new ElectricCar('Tesla', 'Model S', 2021, 50);
myElectricCar.start();
myElectricCar.stop();
myElectricCar.charge();
function showBatteryLevel(car: ElectricVehicle) {
console.log(`Battery Level: ${car.batteryLevel}%`);
}
showBatteryLevel(myElectricCar);
data() {
return {
title: 'My Vue App',
items: [] as Array<{ id: number; name: string; }>,
};
},
mounted() {
this.loadItems();
},
methods: {
async loadItems() {
const data = await fetch('/api/items');
this.items = await data.json();
},
addItem() {
const newItem = {
id: this.items.length + 1,
name: `Item ${this.items.length + 1}`,
};
this.items.push(newItem);
},
removeItem(id: number) {
this.items = this.items.filter(item => item.id !== id);
},
updateTitle() {
this.title = 'Updated Title';
},
clearItems() {
this.items = [];
},
sortItems() {
this.items.sort((a, b) => a.name.localeCompare(b.name));
},
reverseItems() {
this.items.reverse();
},
duplicateItems() {
this.items = [...this.items, ...this.items];
},
fetchMoreItems() {
// Fetch more items and add to the list
},
logItemCount() {
console.log(`Item count: ${this.items.length}`);
}
}
<div class='container'>
<div class='header'>
<h1>{{ title }}</h1>
</div>
<div class='content'>
<div v-for='item in items' :key='item.id' class='card'>
<div class='card-header'>
{{ item.title }}
</div>
<div class='card-content'>
{{ item.description }}
</div>
<button @click='removeItem(item.id)' class='button'>
Remove
</button>
</div>
</div>
<div class='footer'>
<button @click='addItem' class='button'>
Add Item
</button>
</div>
<div class='modal' v-if='showModal'>
<div class='modal-content'>
<h2>Are you sure?</h2>
<button @click='confirm' class='button'>
Yes
</button>
<button @click='cancel' class='button'>
No
</button>
</div>
</div>
<div class='pagination'>
<button @click='prevPage' class='button' :disabled='currentPage <= 1'>
Prev
</button>
<span>{{ currentPage }}</span>
<button @click='nextPage' class='button' :disabled='currentPage >= totalPages'>
Next
</button>
</div>
</div>
import { ref, onMounted, computed } from 'vue';
const title = ref('My Vue App');
const items = ref([]);
const showModal = ref(false);
const currentPage = ref(1);
const itemsPerPage = ref(10);
onMounted(async () => {
const data = await fetch('/api/items');
items.value = await data.json();
});
const totalPages = computed(() => {
return Math.ceil(items.value.length / itemsPerPage.value);
});
const addItem = () => {
const newItem = {
id: items.value.length + 1,
title: `Item ${items.value.length + 1}`,
description: 'This is a description.',
};
items.value.push(newItem);
};
const removeItem = (id) => {
items.value = items.value.filter(item => item.id !== id);
};
const nextPage = () => {
if (currentPage.value < totalPages.value) {
currentPage.value++;
}
};
const prevPage = () => {
if (currentPage.value > 1) {
currentPage.value--;
}
};
const confirm = () => {
showModal.value = false;
// Perform some action
};
const cancel = () => {
showModal.value = false;
};
const fetchMoreItems = async () => {
const data = await fetch(`/api/items?page=${currentPage.value}`);
const newItems = await data.json();
items.value = [...items.value, ...newItems];
};
import { SomeClass } from './some-module';
interface Person {
name: string;
age: number;
}
class MyClass {
private data: T[] = [];
constructor() {
// Initialize
}
add(item: T) {
this.data.push(item);
}
remove(index: number) {
this.data.splice(index, 1);
}
getAll(): T[] {
return this.data;
}
}
function delay(ms: number): Promise {
return new Promise(resolve => setTimeout(resolve, ms));
}
async function fetchData(): Promise<string[]> {
await delay(1000);
return ['data1', 'data2', 'data3'];
}
const person: Person = {
name: 'John Doe',
age: 30,
};
const myClassInstance = new MyClass ();
myClassInstance.add(10);
myClassInstance.add(20);
myClassInstance.remove(0);
const allData = myClassInstance.getAll();
fetchData().then(data => {
console.log(data);
});
console.log(person.name);
console.log(person.age);
body {
font-family: Arial, sans-serif;
background-color: #f2f2f2;
}
h1 {
color: #333333;
font-size: 24px;
margin-bottom: 10px;
}
.container {
width: 100%;
max-width: 1200px;
margin: 0 auto;
padding: 20px;
}
.button {
display: inline-block;
padding: 10px 20px;
background-color: #007bff;
color: #ffffff;
text-decoration: none;
border-radius: 4px;
transition: background-color 0.3s ease;
}
.button:hover {
background-color: #0056b3;
}
.card {
background-color: #ffffff;
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
padding: 20px;
margin-bottom: 20px;
}
.form-group {
margin-bottom: 10px;
}
.input-field {
width: 100%;
padding: 10px;
border: 1px solid #cccccc;
border-radius: 4px;
}
.error-message {
color: #ff0000;
font-size: 14px;
}
import { ref, onMounted, computed } from 'vue';
import axios from 'axios';
const title = ref('My Vue App');
const items = ref([]);
const showModal = ref(false);
const currentPage = ref(1);
const itemsPerPage = ref(10);
const totalPages = computed(() => {
return Math.ceil(items.value.length / itemsPerPage.value);
});
const fetchItems = async () => {
const response = await axios.get('/api/items');
items.value = response.data;
};
const addItem = () => {
const newItem = {
id: items.value.length + 1,
title: `Item ${items.value.length + 1}`,
description: 'This is a description.'
};
items.value.push(newItem);
};
const removeItem = (id) => {
items.value = items.value.filter(item => item.id !== id);
};
const nextPage = () => {
if (currentPage.value < totalPages.value) {
currentPage.value++;
}
};
const prevPage = () => {
if (currentPage.value > 1) {
currentPage.value--;
}
};
const confirmModal = () => {
showModal.value = false;
// Perform some action
};
const cancelModal = () => {
showModal.value = false;
};
onMounted(() => {
fetchItems();
});
data() {
return {
title: 'My Vue App',
items: [] as Array<{ id: number; name: string; }>,
};
},
mounted() {
this.loadItems();
},
methods: {
async loadItems() {
const data = await fetch('/api/items');
this.items = await data.json();
},
addItem() {
const newItem = {
id: this.items.length + 1,
name: `Item ${this.items.length + 1}`,
};
this.items.push(newItem);
},
removeItem(id: number) {
this.items = this.items.filter(item => item.id !== id);
},
updateTitle() {
this.title = 'Updated Title';
},
clearItems() {
this.items = [];
},
sortItems() {
this.items.sort((a, b) => a.name.localeCompare(b.name));
},
reverseItems() {
this.items.reverse();
},
duplicateItems() {
this.items = [...this.items, ...this.items];
},
fetchMoreItems() {
// Fetch more items and add to the list
},
logItemCount() {
console.log(`Item count: ${this.items.length}`);
}
}
data() {
return {
title: 'My Vue App',
items: [] as Array<{ id: number; name: string; }>,
};
},
mounted() {
this.loadItems();
},
methods: {
async loadItems() {
const data = await fetch('/api/items');
this.items = await data.json();
},
addItem() {
const newItem = {
id: this.items.length + 1,
name: `Item ${this.items.length + 1}`,
};
this.items.push(newItem);
},
removeItem(id: number) {
this.items = this.items.filter(item => item.id !== id);
},
updateTitle() {
this.title = 'Updated Title';
},
clearItems() {
this.items = [];
},
sortItems() {
this.items.sort((a, b) => a.name.localeCompare(b.name));
},
reverseItems() {
this.items.reverse();
},
duplicateItems() {
this.items = [...this.items, ...this.items];
},
fetchMoreItems() {
// Fetch more items and add to the list
},
logItemCount() {
console.log(`Item count: ${this.items.length}`);
}
}
interface Vehicle {
make: string;
model: string;
year: number;
start(): void;
stop(): void;
}
interface ElectricVehicle extends Vehicle {
batteryLevel: number;
charge(): void;
}
class Car implements Vehicle {
constructor(public make: string, public model: string, public year: number) {}
start() {
console.log(`${this.make} ${this.model} is starting...`);
}
stop() {
console.log(`${this.make} ${this.model} is stopping...`);
}
}
class ElectricCar extends Car implements ElectricVehicle {
batteryLevel: number;
constructor(make: string, model: string, year: number, batteryLevel: number) {
super(make, model, year);
this.batteryLevel = batteryLevel;
}
charge() {
console.log('Charging...');
this.batteryLevel = 100;
}
}
const myCar = new Car('Toyota', 'Corolla', 2021);
myCar.start();
myCar.stop();
const myElectricCar = new ElectricCar('Tesla', 'Model S', 2021, 50);
myElectricCar.start();
myElectricCar.stop();
myElectricCar.charge();
function showBatteryLevel(car: ElectricVehicle) {
console.log(`Battery Level: ${car.batteryLevel}%`);
}
showBatteryLevel(myElectricCar);
data() {
return {
title: 'My Vue App',
items: [] as Array<{ id: number; name: string; }>,
};
},
mounted() {
this.loadItems();
},
methods: {
async loadItems() {
const data = await fetch('/api/items');
this.items = await data.json();
},
addItem() {
const newItem = {
id: this.items.length + 1,
name: `Item ${this.items.length + 1}`,
};
this.items.push(newItem);
},
removeItem(id: number) {
this.items = this.items.filter(item => item.id !== id);
},
updateTitle() {
this.title = 'Updated Title';
},
clearItems() {
this.items = [];
},
sortItems() {
this.items.sort((a, b) => a.name.localeCompare(b.name));
},
reverseItems() {
this.items.reverse();
},
duplicateItems() {
this.items = [...this.items, ...this.items];
},
fetchMoreItems() {
// Fetch more items and add to the list
},
logItemCount() {
console.log(`Item count: ${this.items.length}`);
}
}
<div class='container'>
<div class='header'>
<h1>{{ title }}</h1>
</div>
<div class='content'>
<div v-for='item in items' :key='item.id' class='card'>
<div class='card-header'>
{{ item.title }}
</div>
<div class='card-content'>
{{ item.description }}
</div>
<button @click='removeItem(item.id)' class='button'>
Remove
</button>
</div>
</div>
<div class='footer'>
<button @click='addItem' class='button'>
Add Item
</button>
</div>
<div class='modal' v-if='showModal'>
<div class='modal-content'>
<h2>Are you sure?</h2>
<button @click='confirm' class='button'>
Yes
</button>
<button @click='cancel' class='button'>
No
</button>
</div>
</div>
<div class='pagination'>
<button @click='prevPage' class='button' :disabled='currentPage <= 1'>
Prev
</button>
<span>{{ currentPage }}</span>
<button @click='nextPage' class='button' :disabled='currentPage >= totalPages'>
Next
</button>
</div>
</div>
import { ref, onMounted, computed } from 'vue';
const title = ref('My Vue App');
const items = ref([]);
const showModal = ref(false);
const currentPage = ref(1);
const itemsPerPage = ref(10);
onMounted(async () => {
const data = await fetch('/api/items');
items.value = await data.json();
});
const totalPages = computed(() => {
return Math.ceil(items.value.length / itemsPerPage.value);
});
const addItem = () => {
const newItem = {
id: items.value.length + 1,
title: `Item ${items.value.length + 1}`,
description: 'This is a description.',
};
items.value.push(newItem);
};
const removeItem = (id) => {
items.value = items.value.filter(item => item.id !== id);
};
const nextPage = () => {
if (currentPage.value < totalPages.value) {
currentPage.value++;
}
};
const prevPage = () => {
if (currentPage.value > 1) {
currentPage.value--;
}
};
const confirm = () => {
showModal.value = false;
// Perform some action
};
const cancel = () => {
showModal.value = false;
};
const fetchMoreItems = async () => {
const data = await fetch(`/api/items?page=${currentPage.value}`);
const newItems = await data.json();
items.value = [...items.value, ...newItems];
};
import { SomeClass } from './some-module';
interface Person {
name: string;
age: number;
}
class MyClass {
private data: T[] = [];
constructor() {
// Initialize
}
add(item: T) {
this.data.push(item);
}
remove(index: number) {
this.data.splice(index, 1);
}
getAll(): T[] {
return this.data;
}
}
function delay(ms: number): Promise {
return new Promise(resolve => setTimeout(resolve, ms));
}
async function fetchData(): Promise<string[]> {
await delay(1000);
return ['data1', 'data2', 'data3'];
}
const person: Person = {
name: 'John Doe',
age: 30,
};
const myClassInstance = new MyClass ();
myClassInstance.add(10);
myClassInstance.add(20);
myClassInstance.remove(0);
const allData = myClassInstance.getAll();
fetchData().then(data => {
console.log(data);
});
console.log(person.name);
console.log(person.age);
body {
font-family: Arial, sans-serif;
background-color: #f2f2f2;
}
h1 {
color: #333333;
font-size: 24px;
margin-bottom: 10px;
}
.container {
width: 100%;
max-width: 1200px;
margin: 0 auto;
padding: 20px;
}
.button {
display: inline-block;
padding: 10px 20px;
background-color: #007bff;
color: #ffffff;
text-decoration: none;
border-radius: 4px;
transition: background-color 0.3s ease;
}
.button:hover {
background-color: #0056b3;
}
.card {
background-color: #ffffff;
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
padding: 20px;
margin-bottom: 20px;
}
.form-group {
margin-bottom: 10px;
}
.input-field {
width: 100%;
padding: 10px;
border: 1px solid #cccccc;
border-radius: 4px;
}
.error-message {
color: #ff0000;
font-size: 14px;
}
import { ref, onMounted, computed } from 'vue';
import axios from 'axios';
const title = ref('My Vue App');
const items = ref([]);
const showModal = ref(false);
const currentPage = ref(1);
const itemsPerPage = ref(10);
const totalPages = computed(() => {
return Math.ceil(items.value.length / itemsPerPage.value);
});
const fetchItems = async () => {
const response = await axios.get('/api/items');
items.value = response.data;
};
const addItem = () => {
const newItem = {
id: items.value.length + 1,
title: `Item ${items.value.length + 1}`,
description: 'This is a description.'
};
items.value.push(newItem);
};
const removeItem = (id) => {
items.value = items.value.filter(item => item.id !== id);
};
const nextPage = () => {
if (currentPage.value < totalPages.value) {
currentPage.value++;
}
};
const prevPage = () => {
if (currentPage.value > 1) {
currentPage.value--;
}
};
const confirmModal = () => {
showModal.value = false;
// Perform some action
};
const cancelModal = () => {
showModal.value = false;
};
onMounted(() => {
fetchItems();
});
data() {
return {
title: 'My Vue App',
items: [] as Array<{ id: number; name: string; }>,
};
},
mounted() {
this.loadItems();
},
methods: {
async loadItems() {
const data = await fetch('/api/items');
this.items = await data.json();
},
addItem() {
const newItem = {
id: this.items.length + 1,
name: `Item ${this.items.length + 1}`,
};
this.items.push(newItem);
},
removeItem(id: number) {
this.items = this.items.filter(item => item.id !== id);
},
updateTitle() {
this.title = 'Updated Title';
},
clearItems() {
this.items = [];
},
sortItems() {
this.items.sort((a, b) => a.name.localeCompare(b.name));
},
reverseItems() {
this.items.reverse();
},
duplicateItems() {
this.items = [...this.items, ...this.items];
},
fetchMoreItems() {
// Fetch more items and add to the list
},
logItemCount() {
console.log(`Item count: ${this.items.length}`);
}
}
data() {
return {
title: 'My Vue App',
items: [] as Array<{ id: number; name: string; }>,
};
},
mounted() {
this.loadItems();
},
methods: {
async loadItems() {
const data = await fetch('/api/items');
this.items = await data.json();
},
addItem() {
const newItem = {
id: this.items.length + 1,
name: `Item ${this.items.length + 1}`,
};
this.items.push(newItem);
},
removeItem(id: number) {
this.items = this.items.filter(item => item.id !== id);
},
updateTitle() {
this.title = 'Updated Title';
},
clearItems() {
this.items = [];
},
sortItems() {
this.items.sort((a, b) => a.name.localeCompare(b.name));
},
reverseItems() {
this.items.reverse();
},
duplicateItems() {
this.items = [...this.items, ...this.items];
},
fetchMoreItems() {
// Fetch more items and add to the list
},
logItemCount() {
console.log(`Item count: ${this.items.length}`);
}
}
interface Vehicle {
make: string;
model: string;
year: number;
start(): void;
stop(): void;
}
interface ElectricVehicle extends Vehicle {
batteryLevel: number;
charge(): void;
}
class Car implements Vehicle {
constructor(public make: string, public model: string, public year: number) {}
start() {
console.log(`${this.make} ${this.model} is starting...`);
}
stop() {
console.log(`${this.make} ${this.model} is stopping...`);
}
}
class ElectricCar extends Car implements ElectricVehicle {
batteryLevel: number;
constructor(make: string, model: string, year: number, batteryLevel: number) {
super(make, model, year);
this.batteryLevel = batteryLevel;
}
charge() {
console.log('Charging...');
this.batteryLevel = 100;
}
}
const myCar = new Car('Toyota', 'Corolla', 2021);
myCar.start();
myCar.stop();
const myElectricCar = new ElectricCar('Tesla', 'Model S', 2021, 50);
myElectricCar.start();
myElectricCar.stop();
myElectricCar.charge();
function showBatteryLevel(car: ElectricVehicle) {
console.log(`Battery Level: ${car.batteryLevel}%`);
}
showBatteryLevel(myElectricCar);
data() {
return {
title: 'My Vue App',
items: [] as Array<{ id: number; name: string; }>,
};
},
mounted() {
this.loadItems();
},
methods: {
async loadItems() {
const data = await fetch('/api/items');
this.items = await data.json();
},
addItem() {
const newItem = {
id: this.items.length + 1,
name: `Item ${this.items.length + 1}`,
};
this.items.push(newItem);
},
removeItem(id: number) {
this.items = this.items.filter(item => item.id !== id);
},
updateTitle() {
this.title = 'Updated Title';
},
clearItems() {
this.items = [];
},
sortItems() {
this.items.sort((a, b) => a.name.localeCompare(b.name));
},
reverseItems() {
this.items.reverse();
},
duplicateItems() {
this.items = [...this.items, ...this.items];
},
fetchMoreItems() {
// Fetch more items and add to the list
},
logItemCount() {
console.log(`Item count: ${this.items.length}`);
}
}
<div class='container'>
<div class='header'>
<h1>{{ title }}</h1>
</div>
<div class='content'>
<div v-for='item in items' :key='item.id' class='card'>
<div class='card-header'>
{{ item.title }}
</div>
<div class='card-content'>
{{ item.description }}
</div>
<button @click='removeItem(item.id)' class='button'>
Remove
</button>
</div>
</div>
<div class='footer'>
<button @click='addItem' class='button'>
Add Item
</button>
</div>
<div class='modal' v-if='showModal'>
<div class='modal-content'>
<h2>Are you sure?</h2>
<button @click='confirm' class='button'>
Yes
</button>
<button @click='cancel' class='button'>
No
</button>
</div>
</div>
<div class='pagination'>
<button @click='prevPage' class='button' :disabled='currentPage <= 1'>
Prev
</button>
<span>{{ currentPage }}</span>
<button @click='nextPage' class='button' :disabled='currentPage >= totalPages'>
Next
</button>
</div>
</div>
import { ref, onMounted, computed } from 'vue';
const title = ref('My Vue App');
const items = ref([]);
const showModal = ref(false);
const currentPage = ref(1);
const itemsPerPage = ref(10);
onMounted(async () => {
const data = await fetch('/api/items');
items.value = await data.json();
});
const totalPages = computed(() => {
return Math.ceil(items.value.length / itemsPerPage.value);
});
const addItem = () => {
const newItem = {
id: items.value.length + 1,
title: `Item ${items.value.length + 1}`,
description: 'This is a description.',
};
items.value.push(newItem);
};
const removeItem = (id) => {
items.value = items.value.filter(item => item.id !== id);
};
const nextPage = () => {
if (currentPage.value < totalPages.value) {
currentPage.value++;
}
};
const prevPage = () => {
if (currentPage.value > 1) {
currentPage.value--;
}
};
const confirm = () => {
showModal.value = false;
// Perform some action
};
const cancel = () => {
showModal.value = false;
};
const fetchMoreItems = async () => {
const data = await fetch(`/api/items?page=${currentPage.value}`);
const newItems = await data.json();
items.value = [...items.value, ...newItems];
};
import { SomeClass } from './some-module';
interface Person {
name: string;
age: number;
}
class MyClass {
private data: T[] = [];
constructor() {
// Initialize
}
add(item: T) {
this.data.push(item);
}
remove(index: number) {
this.data.splice(index, 1);
}
getAll(): T[] {
return this.data;
}
}
function delay(ms: number): Promise {
return new Promise(resolve => setTimeout(resolve, ms));
}
async function fetchData(): Promise<string[]> {
await delay(1000);
return ['data1', 'data2', 'data3'];
}
const person: Person = {
name: 'John Doe',
age: 30,
};
const myClassInstance = new MyClass ();
myClassInstance.add(10);
myClassInstance.add(20);
myClassInstance.remove(0);
const allData = myClassInstance.getAll();
fetchData().then(data => {
console.log(data);
});
console.log(person.name);
console.log(person.age);
body {
font-family: Arial, sans-serif;
background-color: #f2f2f2;
}
h1 {
color: #333333;
font-size: 24px;
margin-bottom: 10px;
}
.container {
width: 100%;
max-width: 1200px;
margin: 0 auto;
padding: 20px;
}
.button {
display: inline-block;
padding: 10px 20px;
background-color: #007bff;
color: #ffffff;
text-decoration: none;
border-radius: 4px;
transition: background-color 0.3s ease;
}
.button:hover {
background-color: #0056b3;
}
.card {
background-color: #ffffff;
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
padding: 20px;
margin-bottom: 20px;
}
.form-group {
margin-bottom: 10px;
}
.input-field {
width: 100%;
padding: 10px;
border: 1px solid #cccccc;
border-radius: 4px;
}
.error-message {
color: #ff0000;
font-size: 14px;
}
import { ref, onMounted, computed } from 'vue';
import axios from 'axios';
const title = ref('My Vue App');
const items = ref([]);
const showModal = ref(false);
const currentPage = ref(1);
const itemsPerPage = ref(10);
const totalPages = computed(() => {
return Math.ceil(items.value.length / itemsPerPage.value);
});
const fetchItems = async () => {
const response = await axios.get('/api/items');
items.value = response.data;
};
const addItem = () => {
const newItem = {
id: items.value.length + 1,
title: `Item ${items.value.length + 1}`,
description: 'This is a description.'
};
items.value.push(newItem);
};
const removeItem = (id) => {
items.value = items.value.filter(item => item.id !== id);
};
const nextPage = () => {
if (currentPage.value < totalPages.value) {
currentPage.value++;
}
};
const prevPage = () => {
if (currentPage.value > 1) {
currentPage.value--;
}
};
const confirmModal = () => {
showModal.value = false;
// Perform some action
};
const cancelModal = () => {
showModal.value = false;
};
onMounted(() => {
fetchItems();
});
data() {
return {
title: 'My Vue App',
items: [] as Array<{ id: number; name: string; }>,
};
},
mounted() {
this.loadItems();
},
methods: {
async loadItems() {
const data = await fetch('/api/items');
this.items = await data.json();
},
addItem() {
const newItem = {
id: this.items.length + 1,
name: `Item ${this.items.length + 1}`,
};
this.items.push(newItem);
},
removeItem(id: number) {
this.items = this.items.filter(item => item.id !== id);
},
updateTitle() {
this.title = 'Updated Title';
},
clearItems() {
this.items = [];
},
sortItems() {
this.items.sort((a, b) => a.name.localeCompare(b.name));
},
reverseItems() {
this.items.reverse();
},
duplicateItems() {
this.items = [...this.items, ...this.items];
},
fetchMoreItems() {
// Fetch more items and add to the list
},
logItemCount() {
console.log(`Item count: ${this.items.length}`);
}
}

Octopus Order

Eine App - Alle Bestellungen

mom to be

Die Schwangerschafts-App mit den wirklich wichtigen To-Dos

Marketprint

Print-on-Demand Produktionsdigitalisierung und Shopify Shop

The Länd - Messeprojekt

Eine informative Ausstellungs-App

DGHS

Die DGHS-App bietet Mitgliedern Notfallhilfe durch Ausweise, SMS und Lebenszeichen-Service.

motan

Die motan App vereinfacht die Zeiterfassung für Montageprojekte