[Vuejs]-Can we use expose method to return other reactive variables and computed properties like methods in vue 3?

0👍

created hook in the composition api

This one is simple, there is no created or beforeCreate hook in the composition api. It is entirely replaced by setup. You can just run your code in the setup function directly or put it in a function you call from within setup.

Are properties exposed using expose reactive

Yes. While accessing values of child components using template refs is not really the "Vue"-way, it is possible and the values passed keep their reactivity. I couldn’t find any documentation on this, so I quickly implemented a small code sandbox to try it out. See for yourself.

https://codesandbox.io/s/falling-breeze-twetx3?file=/src/App.vue

(If you encounter an error similar to "Cannot use import outside a module", just reload the browser within code sandbox, there seems to be an issue with the code sandbox template)

Leave a comment