Home > front end >  Vue form is submitted
Vue form is submitted

Time:10-09

Name: & lt; Input type="text" id="txtName"/& gt;

Age: & lt; Input type="text" id="txtAge"/& gt;





New Vue ({
El: '# FRM,
Data:
{
Flag: false
},
Methods:
{
SMT: function () {
Return checkForm ();
}
}
})

The function checkForm () {
Var txtNameObj=document. GetElementById (" txtName ");
Var txtAgeObj=document. GetElementById (" txtAge ");
If (txtNameObj. Value. Length==0) {
Window. The alert (" account can't be empty!" );
TxtNameObj. Focus ();
return;
} else if (txtAgeObj. Value. Length==0) {
Window. The alert (" age can't for empty!" );
TxtAgeObj. Focus ();
return;
}
. This flag=true;
return true;
}

Be free and at leisure work Vue, find out how this submit button doesn't trigger, validation is normal, in this way how to change? Thank you very much!
  • Related