chrisvfritz / prerender-spa-plugin

Prerenders static HTML in a single-page application.
MIT License
7.31k stars 633 forks source link

How to render after async event in v3.x version #228

Open zgj233 opened 5 years ago

zgj233 commented 5 years ago

my project is vue project which make by vue-cli. I want to prerender after ArticleList.vue ajaxCompleted and v-for render to complete. I have used renderAfterDocumentEvent option, but I didn't work. image

And , this is my ArticleList.vue code image

Then I run npm run build, Error: image

In vue2-webpack-router I saw document.dispatchEvent(new Event('custom-render-trigger')) was writed in main.js. Must I do the same?

What should I do if I want to prerending after a certain routing component has been rendered. Thank you very much.

JoshTheDerf commented 5 years ago

That should be correct, but I have no idea why you're getting a Protocol Error. Might be a puppeteer issue.

zgj233 commented 5 years ago

@Tribex Excuse me sir, renderAfterDocumentEvent This method can only listen once in global project, or each route can listen once?

zgj233 commented 5 years ago

This this plugin really support Ajax?I open my backEnd, and watch request path's console. no message have printed. I doesn't run ajax code during the prerending, I didn't work.

JoshTheDerf commented 5 years ago

It listens once for each route. The Ajax request should be going through. Watch the network panel. You may need to use setTimeout before firing the event after the request finishes.

On Tue, Aug 7, 2018, 5:03 AM ZGJ notifications@github.com wrote:

This this plugin really support Ajax?I open my backEnd, and watch request path's console. no message have printed. I doesn't run ajax code during the prerending, I didn't work.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/chrisvfritz/prerender-spa-plugin/issues/228#issuecomment-410987441, or mute the thread https://github.com/notifications/unsubscribe-auth/AFlv-0sXSSjW3cOKkc1z_btgNfBZAQgnks5uOVf9gaJpZM4Vv4cI .

-- Web Developer & IT Professional Creation Ministries International (US) https://creation.com/ Phone: (770) 630-6154