on

Register events listeners for Custom Events emitted using $emit. Accepts a String, Array or an Object.

String

// Option 1: String
data() {
  return {
    uiSchema: [{
      component: 'input',
      fieldOptions: {
        on: 'input'
      }
    }]
  }
}

Array

// Option 2: Arrays
data() {
  return {
    uiSchema: [{
      component: 'input',
      fieldOptions: {
        on: [
          'input'
        ]
      }
    }]
  }
}

Object

An Object can be used if the value should be manipulated or used elsewhere before set in to the model.

Note that the callback must be synchronous

// Option 3: Object
data() {
  return {
    uiSchema: {
      component: 'input',
      fieldOptions: {
        on: {
          'change': value => String(value).toLowerCase();
        }
      }
    }
  }
}

Last updated