admin管理员组文章数量:1025784
I'm currently trying out Vue 3's Composition API, using a main app and several position funtions, aka 'posables'. I studied official docs and several tuts. It seems there are many ways of acplish the same tasks, so I was wandering what is the best for a couple of things:
how to pass reactive variables from the main app to the posables? I mean: should I just pass them as the posable's parameters or should I do it some othe way?
how to use other app's methods or other posables from a posable? :)
I'm currently trying out Vue 3's Composition API, using a main app and several position funtions, aka 'posables'. I studied official docs and several tuts. It seems there are many ways of acplish the same tasks, so I was wandering what is the best for a couple of things:
how to pass reactive variables from the main app to the posables? I mean: should I just pass them as the posable's parameters or should I do it some othe way?
how to use other app's methods or other posables from a posable? :)
1 Answer
Reset to default 4You could pass any raw/reactive data as posable parameter, but make sure to make the posable function more independent from the ponent logic (to make it more reusable), you could check Vuetify 3 posable functions and vueuse to get inspired.
Pass them as parameters then run them when needed inside the posable logic.
I'm currently trying out Vue 3's Composition API, using a main app and several position funtions, aka 'posables'. I studied official docs and several tuts. It seems there are many ways of acplish the same tasks, so I was wandering what is the best for a couple of things:
how to pass reactive variables from the main app to the posables? I mean: should I just pass them as the posable's parameters or should I do it some othe way?
how to use other app's methods or other posables from a posable? :)
I'm currently trying out Vue 3's Composition API, using a main app and several position funtions, aka 'posables'. I studied official docs and several tuts. It seems there are many ways of acplish the same tasks, so I was wandering what is the best for a couple of things:
how to pass reactive variables from the main app to the posables? I mean: should I just pass them as the posable's parameters or should I do it some othe way?
how to use other app's methods or other posables from a posable? :)
1 Answer
Reset to default 4You could pass any raw/reactive data as posable parameter, but make sure to make the posable function more independent from the ponent logic (to make it more reusable), you could check Vuetify 3 posable functions and vueuse to get inspired.
Pass them as parameters then run them when needed inside the posable logic.
本文标签:
版权声明:本文标题:javascript - What's the bestrecommended way to pass reactive props from components to composables in Vue 3 Composition A 内容由热心网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://it.en369.cn/questions/1745639232a2160638.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论