Skip to content

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.

2 participants