Vue.JS custom radio button component requires clicking twice Vue.JS custom radio button component requires clicking twice vue.js vue.js

Vue.JS custom radio button component requires clicking twice


Not exactly sure what's causing that bug, but I see that you're doing some unnecessary data-binding that are apparently causing the issue.

  1. Change the radio component template to this (don't need to pass a value or bind a v-model):

    <div><input :name="name" type="radio" @change="update"><slot></slot></div>

  2. Get rid of the val data property (since it isn't being used now).

  3. Change your update method to this.$emit('change', this.value); (you can just directly reference the value you've assigned this radio component).