[vue v3] How to access to internal props from app.config.errorHandler via component instance #10235
Unanswered
anhnhoktvn
asked this question in
Help/Questions
Replies: 2 comments 4 replies
-
@anhnhoktvn
<script setup>
let prop1 = 123
function f1 () {
// ...
}
defineExpose({
f1,
prop1
}) Now you can access with ref:
//Comp2.vue
<script setup>
const compRef= ref()
app.config.errorHandler = (err, info) => {
compRef.value.f1()
console.log(compRef.value.prop1)
}
</script>
<template>
<Comp1 ref="compRef" />
</template> Note: You can only access the compRef value after mounting the component |
Beta Was this translation helpful? Give feedback.
4 replies
-
Let me know if you got it. If yes, mark the answer as "answered". |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Inside setup section. I have something like:
is there a way to access prop1 and/or f1 outside of the component.
for example: when I got an error from
app.config.errorHandler
could I acess to those props ?. somethig like
Beta Was this translation helpful? Give feedback.
All reactions