Send component data to vuex upon registration

vuex

#1

Hi all. I’m trying to solve an interesting problem…

I’d like to send component data to vuex upon component registration – instead of upon the component rendering.

I have a set of components whose data creates a “map” of sorts, and this data is needed right at the beginning of a page load. However, I’m trying to transition between these components in Vue, and thus, all but my first component aren’t rendered until they are viewed at a later time.

Hope that makes sense. Any suggestions?

Thanks!


#2

Can you just dispatch an action in mounted or created?


#3

Unfortunately, no. Lifecycle hooks won’t quite solve this specific problem. The reason being, it seems there is no beforeCreate or created event to hook into, since the component transition seems to inhibit the lifecycle hook process. I believe that’s what’s happening anyway, as I’ve tried both of those hooks already.


#4

… that is… Wrapping a set of components in a transition – or creating a dynamic component for transition – seems to keep all its “non-active” components from beginning the lifecycle process.


#5

So, basically, I’d like to use components’ data while in the “off” position due to a transition keeping it from being rendered.


#6

Code speaks many words. Hard to envision what you’re going through without some examples.