实例:

1. 不进行检验:

emits: ['enlargeText'],//列出自定义事件
template:`
<button @click="$emit('enlargeText', 0.1)">
  Enlarge text
</button>`

2. 进行事件检验:

app.component('custom-form', {
  emits: {
    // 没有验证
    click: null,
    // 验证 submit 事件
    submit: ({ email, password }) => {
      if (email && password) {
        return true//检验成功
      } else {
        console.warn('Invalid submit event payload!')
        return false//检验失败, Vue弹出警告
      }
    }
  },
  methods: {
    submitForm(email, password) {
      this.$emit('submit', { email, password })
    }
  }
})