Aurian JAULT 1 year ago
commit 964aa2f3c1

@ -3,7 +3,7 @@ export default{
return {
teams:[],
news: [],
id:'',
id: 1,
name:'',
description:'',
teamClicked: false,
@ -39,15 +39,10 @@ export default{
},
checkFields: function() {
this.errMessage="";
document.querySelector("#id").removeAttribute("style");
document.querySelector("#name").removeAttribute("style");
document.querySelector("#desc").removeAttribute("style");
if(this.id===""||this.name===""||this.description===""){
if(this.name===""||this.description===""){
this.errMessage+="The";
if(this.id===""){
this.errMessage+=" id";
document.querySelector("#id").setAttribute("style","border: 1px solid #d66");
}
if(this.name===""){
this.errMessage+=" name";
document.querySelector("#name").setAttribute("style","border: 1px solid #d66");
@ -75,13 +70,12 @@ export default{
console.log(team);
if(!this.edit){//adding a team
this.teams.push(team);
this.id='';
this.name='';
this.description='';
this.id=this.id+1
}
else{//editing a team
this.teams[this.idxEdit]=team;
this.id='';
this.name='';
this.description='';
this.edit=false;
@ -95,12 +89,10 @@ export default{
}
});
if(this.edit){
this.id=team.id;
this.name=team.name ;
this.description=team.description;
}
else{
this.id='';
this.name='';
this.description='';
}
@ -123,11 +115,7 @@ export default{
<form @submit.prevent>
<br>
<label>{{errMessage}}</label><br/>
<div>
<label>id</label><br/>
<input id="id" type="number" v-model="id"/>
</div>
<div>
<label>Name</label><br/>
<input id="name" type="text" v-model="name"/>

Loading…
Cancel
Save