You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
68 lines
2.0 KiB
68 lines
2.0 KiB
<!DOCTYPE html>
|
|
|
|
<html lang="en">
|
|
|
|
<head>
|
|
<title>TP-noté</title>
|
|
</head>
|
|
|
|
<body>
|
|
<div id="app">
|
|
<h1>TP-noté</h1>
|
|
<nav-bar @add-team="addTeam"></nav-bar>
|
|
|
|
<team-card @edit-team="editTeam" v-for="team in teams"
|
|
:id="team.id"
|
|
:nom="team.name"
|
|
:description="team.description">
|
|
</team-card>
|
|
</div>
|
|
|
|
<script src="src/service/link-service.js"></script>
|
|
<script src="src/class/team.js"></script>
|
|
<script src="src/class/api-service.js"></script>
|
|
<script src="src/misc/const.js"></script>
|
|
<script src="main.js"></script>
|
|
<script type="module">
|
|
import { createApp } from 'https://unpkg.com/vue@3/dist/vue.esm-browser.js';
|
|
import NavBar from '/src/view/nav-bar.js';
|
|
import TeamCard from '/src/view/team-card.js';
|
|
const app = createApp({
|
|
created(){},
|
|
data(){
|
|
return{
|
|
teams: [],
|
|
edit:false,
|
|
newTeam:null
|
|
}
|
|
},
|
|
methods:{
|
|
addTeam: function(equipe){
|
|
if(!this.edit){//adding a team
|
|
this.teams.push(equipe);
|
|
}
|
|
else{//editing a team
|
|
this.teams.forEach((e,idx) => {
|
|
if(e.id==this.newTeam.id&&e.name==this.newTeam.name&&e.description==this.newTeam.description){
|
|
this.teams[idx]=equipe;
|
|
}
|
|
});
|
|
this.edit=false;
|
|
this.newTeam=null;
|
|
}
|
|
},
|
|
editTeam: function (team) {
|
|
this.newTeam=team;
|
|
this.edit=!this.edit;
|
|
}
|
|
}
|
|
});
|
|
|
|
app.component('NavBar', NavBar);
|
|
app.component('TeamCard', TeamCard);
|
|
|
|
app.mount('#app');
|
|
</script>
|
|
</body>
|
|
</html>
|