ajout correction tp1-2

This commit is contained in:
keahorvath committed 2023-03-03 15:43:36 +01:00
1 parent 902d02f871
commit 9cce1dd794
34 files changed
+1373

No files matched your search

+36
View File
@@ -0,0 +1,36 @@
<script setup lang="ts">
import { ref } from 'vue';
import router from "@/router";
import { api } from '@/http-api';
import { ImageType } from '@/image'
const selectedId = ref(-1);
const imageList = ref<ImageType[]>([]);
getImageList();
function getImageList() {
api.getImageList().then((data) => {
imageList.value = data;
}).catch(e => {
console.log(e.message);
});
}
function showImage() {
router.push({ name: 'image', params: { id: selectedId.value } })
}
</script>
<template>
<div>
<h3>Choose an image</h3>
<div>
<select v-model="selectedId" @change="showImage">
<option v-for="image in imageList" :value="image.id" :key="image.id">{{ image.name }}</option>
</select>
</div>
</div>
</template>
<style scoped>
</style>