How to fire an event when v-model changes?

后端 未结 5 2138
滥情空心
滥情空心 2020-12-13 02:03

I\'m trying to fire the foo() function with the @click but as you can see, need press the radio button two times to fire the event correctly . Only

5条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2020-12-13 02:42

    This happens because your click handler fires before the value of the radio button changes. You need to listen to the change event instead:

     //here
    

    Also, make sure you really want to call foo() on ready... seems like maybe you don't actually want to do that.

    ready:function(){
        foo();
    },
    

提交回复
热议问题