What is the most efficient way to distribute data in a Vue3 application?
P粉413307845
P粉413307845 2024-03-26 15:19:42
0
1
438

Is there a recommended way to propagate data through vue components? What I want to do is get data from the backend once and propagate it to various locations in my project, but I can't find the right strategy.

sessionStorage: Works great and resets when refreshing/closing the window, but once you need to create a target="_blank" anchor tag it doesn't.

P粉413307845
P粉413307845

reply all(1)
P粉022140576

There are some good arguments as to why Vuex is better than local storage:

https://www.quora.com/What-is-the-benefit-of-using-Vuex-over-LocalStorage-to-store-the-state-of -Application in Vue-js program

You can also try composable items. They are reusable functions (similar to mixins) in composition-api (in vue2 the composition-api plugin is required, in vue3 it is built-in). It can also be where you store your data

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!