Solve the problem of being unable to submit data using the Vant component library form component

The form form of the Vant component was used in the project. When submitting, it was found that there was no data and the submission could not be performed. The problem was that when the form was redesigned, a conditional rendering item was set in the form as shown below:

Clicking the checkbox will hide the column that selects the graduation date, but clicking Save will always fail to submit the form. The problem occurs here, please look at the following code:

 

Here v-show was originally used to judge conditional rendering, but v-show is equivalent to rendering by controlling css attributes. Even if it is hidden, the component is not destroyed, but it still exists but is invisible, so it must be set. When the filled-in form is verified, it cannot pass, so there is no way to submit the form. To solve this problem, use v-if for conditional rendering

Guess you like

Origin blog.csdn.net/weixin_51828648/article/details/130864901