Vue implementation with async data
See original GitHub issueHello, first off, thanks for the great plugin!
So I’ve been trying to build a Vue.js demo that used this prerender-spa-plugin
to generate a static site. I’ve got a good start but was wondering if you could shed some light on some questions I have.
First off, the repo is here --> https://github.com/stursby/vue-prerender-spa-demo
And live Demo --> https://vue-prerender-spa-demo.surge.sh/
So to the issues/questions/etc:
- The ajax data is correctly being rendered in the HTML, but my ajax request is sill being made
- So, is there a way to either to inject that JSON data as a window object during build? (or maybe add a
ssr="true"
key somewhere so I could check in my Vue app an not make the ajax request - I’ve currently got the
captureAfterTime
set to 1000ms… but I know this is fragile. I’ve tried some of the other methods with no success… any help here would be great
Any thoughts would be much appreciated! Thanks 🙌
Issue Analytics
- State:
- Created 6 years ago
- Reactions:1
- Comments:20
Top Results From Across the Web
How to use Async/Await with Vue.js Components
Vue allows any method to be an async method. Here is an example with data requested per click on a button. <button @click="loadUsers">Load ......
Read more >Async Components - Vue.js
As you can see, defineAsyncComponent accepts a loader function that returns a Promise. The Promise's resolve callback should be called when you have...
Read more >How to display async data in vue template - Stack Overflow
There are a few good methods of handling async data in Vue. Call a method that fetches the data in the created lifecycle...
Read more >How to Use Async and Await with Vue.js Apps - Medium
Data will be saved to db.json of the folder that we're in, which should our app's project folder. At the end, we have...
Read more >Async with Composition API - Anthony Fu
There is a major caveat when working with asynchronous functions in Vue Composition API, that I believe many of you have ever come...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I just have it locally. Looks like this:
Config:
Vue: component
Is the issue that I’m only dispatching the Event in Vue components that fetch data?
I see that you can combine
captureAfterTime
andcaptureAfterDocumentEvent
but not sure how to implement that… do I define both keys?Closing for now – ongoing investigation as to whether this is a phantomjs bug in #31