-
I have a page component using the options API. <template>
<div>
{{ foo }}
</div>
</template>
<script>
export default {
data: () => ({
foo: 'baz'
}),
serverPrefetch() {
this.foo = 'bar';
}
}
</script> From the server, the HTML comes with |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 16 replies
-
Hi there! I think this looks correct and is the way SSR generally works. The frontend gets To make the re-hydration work well for your case, instead of hardcoding You can do this in the Also, make sure you modify I think I should make guide on common SSR questions like this with examples 🤔 Hope that helps! |
Beta Was this translation helpful? Give feedback.
-
Ahh, I see what you mean now. I thought you were saying to fetch the data first, then put it into initialState and then pass it to the component (although that's possible too I guess, for the logged in user example). My bad.
Yeah, I didn't mention those cause of the lack of Vitedge looks really cool, I'm just not familiar with that type of workflow and deployment, but with your response I should be able to keep going with vite-ssr. Thanks for your time! |
Beta Was this translation helpful? Give feedback.
-
Would it be possible to provide some hooks like Nuxt's |
Beta Was this translation helpful? Give feedback.
-
End result: #46 (reply in thread) |
Beta Was this translation helpful? Give feedback.
End result: #46 (reply in thread)