This commit is contained in:
2025-08-28 14:34:18 +02:00
commit 5ff4c53a10
29 changed files with 1705 additions and 0 deletions

22
TP4/EX0/my-list.riot Normal file
View File

@@ -0,0 +1,22 @@
<my-list>
<ul>
<li each="{ char in props.personnages }" onclick="{ () => onSelect(char) }">
{ char.prenom } { char.nom } ({ char.age !== null ? char.age : 'âge inconnu' })
</li>
</ul>
<style>
ul { list-style: none; padding: 0; }
li { padding: 10px; border-bottom: 1px solid #eee; cursor: pointer; }
li:hover { background-color: #f0f0f0; }
</style>
<script>
export default {
onSelect(character) {
// Émet un événement 'select' vers le parent avec le personnage sélectionné
this.parent.selectCharacter(character);
}
}
</script>
</my-list>