-
-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
The custom directive is in the production environment, and the function under instance is missing #5018
Labels
🐞 bug
Something isn't working
Comments
the code like: < template >
< button v-operate:add >button< /button >
< /template >
<script setup>
const add = () =>{
console.log('click trigger')
}
</script> app.directive("operate", {
mounted(el, binding) {
const { arg, instance, value } = binding;
console.log(binding);
const { param } = value || {};
if (!instance?.[arg]) {
console.log('not exist ')
return;
}
el.addEventListener('click', instance[arg].bind(instance, param));
},
}) There is no add event defined by me on instance, but it exists in dev environment |
<script setup>
const add = () =>{
console.log('click trigger')
}
defineExpose({
add,
})
</script> See: https://v3.vuejs.org/api/sfc-script-setup.html#defineexpose The source of the difference in behavior is the same as #4980 so I'll close this one as a duplicate. |
@LinusBorg I've used this method before, but it doesn't work |
Seems we expose the wrong proxy here. |
LinusBorg
added a commit
that referenced
this issue
Nov 30, 2021
…ooks has access to exposed properties on closed instances. fix: #5018
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Version
3.0.0
Reproduction link
github.com
Steps to reproduce
npm run serve
npm run serve:prd
What is expected?
The button should be triggered in both environments
What is actually happening?
In dev environment, button be triggered
The text was updated successfully, but these errors were encountered: