Jan 28, 2022
0
Level 2
vue 3 composition api context root
I want to access the root instance (context.root) from a component gives undefined
app:
import router from '@/router';
import VueHtml2Canvas from 'vue-html2canvas';
const app = createApp(App);
const appRoot = app.use(router).use(VueHtml2Canvas).mount("#app");
component:
export default {
props: {
t: String,
},
setup(props, context) {
console.log(context.root)
};
}
in options API :
this.output = await this.$html2canvas(el, options);
but this doesn't work in composition api
Please or to participate in this conversation.