The Wayback Machine - https://web.archive.org/web/20210528140840/https://github.com/vuejs/composition-api/issues/708
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

emits property for Vue 2.7 #708

Open
miralize opened this issue May 26, 2021 · 3 comments
Open

emits property for Vue 2.7 #708

miralize opened this issue May 26, 2021 · 3 comments

Comments

@miralize
Copy link

@miralize miralize commented May 26, 2021

What problem does this feature solve?

Could we introduce the emits property in Vue 2.7, it might be helpful in transitioning to vue 3.

Even if it was only mentioned in the docs , as its useful for documenting the component and it assists in migration.

What does the proposed API look like?

export default {
  name: 'ComponentName'
  emits: ['open', 'close']
  setup(props, { emit }) {
    const close = () => {
      emit('close')      
    }
    const open = () => {
      emit('open')      
    }
    return {
      open,
      close,
    }
}
@posva posva transferred this issue from vuejs/vue May 26, 2021
@Alanscut
Copy link

@Alanscut Alanscut commented May 27, 2021

emits is not a part of compositon-api, vue-compat allows you to use emits in a Vue 2 project, it may help you.

@posva
Copy link
Member

@posva posva commented May 27, 2021

I transferred this issue thinking it could be a feature request for typings of emits in defineComponent. @antfu @pikax I'm sorry if it created any inconvenience, I should have commented at the time I transferred the issue.

@miralize
Copy link
Author

@miralize miralize commented May 27, 2021

My point was more to maybe encourage people on vue 2 to start getting into the habit of documenting the events?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants