Vuejs and jquery using V-model bound values in build projects cannot be emptied

Source: Internet
Author: User

How to empty the input value cache for V-model bindings

In Vue+bootstrap+jquery frame your project, the action button formatter the formatted cell in the list is bound to the bootstrap modal box, and in the Modal box popup page, after binding a value with V-model, Click on the Modal box with the Close modal box button to close the modal box, the next time you click on the action button in the list, after the modal box pops up, the input field in the page will cache the last value after gaining and losing focus.

When you empty the binding value:

1 <input type= "text" id= "Apttrain" class= "Form-control" placeholder= "Train" v-model.trim= "apttrain" @change = "Querytrain (' EndStation1 ')" @focus = "clear" >

You can add a focus event to input to determine if the bound value is empty and then empty the value

1Clearfunction () {2                 varthat = This;3                 //that.ticketgate = null;4                 //$ (' #ticketGate '). Val (');5                 if(That.ticketgate! =NULL|| That.ticketgate! = "){6That.ticketgate =NULL;7$ (' #ticketGate '). Val (' ');8}Else{9 Ten                 } One                 if(That.apttrain! =NULL|| That.apttrain! = "){ AThat.apttrain =NULL; -$ (' #aptTrain '). Val (' '); -}Else{ the  -                 } -  -}

Vuejs and jquery using V-model bound values in build projects cannot be emptied

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.