|
|
|
@ -5,14 +5,31 @@ import teamCard from './teamcard.js';
|
|
|
|
|
export default {
|
|
|
|
|
data: function() {
|
|
|
|
|
return {
|
|
|
|
|
allTeam: []
|
|
|
|
|
allTeam: [],
|
|
|
|
|
teamAEdit: null
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
methods: {
|
|
|
|
|
recupTeam: function (team) {
|
|
|
|
|
console.log('team.addTeam', team);
|
|
|
|
|
this.allTeam.push(team);
|
|
|
|
|
},
|
|
|
|
|
editParam: function (team) {
|
|
|
|
|
this.teamAEdit=team
|
|
|
|
|
console.log('lanceEdit')
|
|
|
|
|
},
|
|
|
|
|
updateTeam: function (team) {
|
|
|
|
|
console.log('update')
|
|
|
|
|
for (var i = 0; i < this.allTeam.length; i++) {
|
|
|
|
|
if (this.allTeam[i].id == this.teamAEdit.id) {
|
|
|
|
|
console.log('update + +')
|
|
|
|
|
this.allTeam[i].name = team.name
|
|
|
|
|
this.allTeam[i].description=team.description
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
},
|
|
|
|
|
components: {
|
|
|
|
|
teamCard,
|
|
|
|
@ -22,12 +39,13 @@ export default {
|
|
|
|
|
<section>
|
|
|
|
|
<h2>News form</h2>
|
|
|
|
|
<div class="team">
|
|
|
|
|
<teamAdd v-on:teamAjoute="recupTeam"></teamAdd>
|
|
|
|
|
<teamAdd :teamAEdit="this.teamAEdit" v-on:teamAjoute="recupTeam" v-on:teamModifie="updateTeam"></teamAdd>
|
|
|
|
|
</div>
|
|
|
|
|
<teamCard v-for="team in allTeam"
|
|
|
|
|
:id="team.id"
|
|
|
|
|
:name="team.name"
|
|
|
|
|
:description="team.description">
|
|
|
|
|
:description="team.description"
|
|
|
|
|
v-on:teamEditer="editParam">
|
|
|
|
|
</teamCard>
|
|
|
|
|
</section>
|
|
|
|
|
`
|
|
|
|
|