Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

Listen to custom event in Vue js

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)"
    >
  `
})
Source by v2.vuejs.org #
 
PREVIOUS NEXT
Tagged: #Listen #custom #event #Vue #js
ADD COMMENT
Topic
Name
9+3 =