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

Add the expose option and expose function #1251

Merged
merged 1 commit into from Sep 25, 2021

Conversation

skirtles-code
Copy link
Contributor

Vue 3.2 introduced defineExpose, the expose option, and the expose function in the setup context object. While defineExpose is documented, the other two are not. This PR adds some documentation for those two forms of expose.

RFC: https://github.com/vuejs/rfcs/blob/master/active-rfcs/0042-expose-api.md

While working on this I noticed that mount returns the internal instance, not the exposed instance. This made it trickier to create simple, complete examples. I'd have preferred the API example to use const vm = Vue.createApp(...).mount(...) to grab the public instance, but that doesn't work. Instead I've used examples that show how to use expose but without explicitly showing how to use the exposed properties. I've opened a PR to change this in vue-next: vuejs/core#4606. If that gets merged we could revisit those examples to make them a little clearer.

@NataliaTepluhina NataliaTepluhina merged commit 9a89e94 into vuejs:master Sep 25, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants