[Vuejs]-Vue component, observed data is not work as expected

0👍

You need to change :checked="value == keyValue" then it will work

Vue.component("radio-button", {
    props: ["keyValue", "name", "value"],
  template: `<label class="nts-radiobox">
              <input ref="radio" type="radio" :name="name" v-bind:value="keyValue" :checked="value == keyValue" @change="changed(keyValue)"/>
              <i class="fa fa-circle-o"></i>
              <slot></slot>
                    </label>`,
    methods: {
            changed: function(value){
                    this.$emit('change', value);
            }
    }
});

Demo on jsfiddle

Leave a comment