Custom Events — Vue.js

PHOTO EMBED

Thu Nov 11 2021 08:48:33 GMT+0000 (Coordinated Universal Time)

Saved by @cecisalof

Vue.component('base-checkbox', {
  model: {
    prop: 'checked',
    event: 'change'
  },
  props: {
    checked: Boolean
  },
  template: `
    <input
      type="checkbox"
      v-bind:checked="checked"
      v-on:change="$emit('change', $event.target.checked)"
    >
  `
})
content_copyCOPY

wORKING WITH RADIO BUTTONS AND EMITING A CUSTOM EVENT

https://vuejs.org/v2/guide/components-custom-events.html