Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Parse vue 3 emit member to the otions object #965

Closed
elevatebart opened this issue Sep 12, 2020 · 1 comment
Closed

Parse vue 3 emit member to the otions object #965

elevatebart opened this issue Sep 12, 2020 · 1 comment
Labels

Comments

@elevatebart
Copy link
Member

The problem

In Vue 3 we can use an "emit" member to the options bag to tell parent components what events are available.
It would be a perfect place to gather information about those events (type, description, payload)

https://v3.vuejs.org/guide/component-custom-events.html#validate-emitted-events

Proposed solution

export default {
emits: {
    /**
     * Click on the button
     */
    click: null,

    /**
     * Validate submit event
     * @arg {object} payload
     * @arg {payload.email} String email of the registered user
     * @arg {payload.password} String password of the registered user
     */
    submit: ({ email, password }) => {
      if (email && password) {
        return true
      } else {
        console.warn('Invalid submit event payload!')
        return false
      }
    }
  },
}
@elevatebart elevatebart added the enhancement New feature or request label Sep 12, 2020
@elevatebart elevatebart added this to todo in vue-docgen-api via automation Sep 12, 2020
@elevatebart
Copy link
Member Author

There would be typescript support as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Development

No branches or pull requests

1 participant