We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
I would like to propose 2 things to defineExpose.
defineExpose
expose
__expose
exposed
const _sfc_main$k = { __name: 'DialogComponent', setup(__props, { expose }) { const exposed = {}; expose(exposed);
onMounted()
Object.assign(exposed, { showModal: async loader => { if (loader) { ({ default: component.value } = await loader()); } $dialog[0].showModal(); }, close: () => $dialog[0].close() });
To make the syntax shorter in the first item of this proposal I suggest to return the exposed object from the expose function:
function createSetupContext(instance) { const expose = exposed => { // return here return (instance.exposed = exposed || {}); }; let attrs; { return { get attrs() { return attrs || (attrs = createAttrsProxy(instance)); }, slots: instance.slots, emit: instance.emit, expose }; } }
so our exposed object could be declared like that giving we solved the both problems:
const expose = defineExpose(); // later add props to the expose for example in `onMounted()`
encode
defineExpose()
The text was updated successfully, but these errors were encountered:
fix(compiler-sfc): avoid codegen conflict with user variable named `e…
c839129
…xpose` (#7949) rename `expose` to `__expose` to avoid duplicate identifier relate #7890
952961d
…xpose` (vuejs#7949) rename `expose` to `__expose` to avoid duplicate identifier relate vuejs#7890
The first one is resolved in #7949
Sorry, something went wrong.
No branches or pull requests
What problem does this feature solve?
I would like to propose 2 things to
defineExpose
.expose
variable more cryptic like__expose
(like props) so we could use anotherexpose
variable (in my case I had to useexposed
:onMounted()
when we have our DOM ready:To make the syntax shorter in the first item of this proposal I suggest to return the exposed object from the expose function:
so our exposed object could be declared like that giving we solved the both problems:
What does the proposed API look like?
encode
script setup parameter generated withdefineExpose()
expose
function the exposed object to use it later;The text was updated successfully, but these errors were encountered: