JS Isn’t Firing
See original GitHub issueHi Chris!
Thanks for the plugin and the demos!
I’ve got the build running properly, and the static pages are rendered, but no JS seems to be loading. I have a few @clicks
and @submits
that aren’t firing when clicked. Is there another step when you have some JS that allows the user to interact with the page?
in main.js
/* eslint-disable no-new */
let root = new Vue({
router,
store,
render: h => h(App)
})
document.addEventListener('DOMContentLoaded', function () {
root.$mount('#app')
})
the other configs are set up like the example in the Vue Spa repo.
Issue Analytics
- State:
- Created 7 years ago
- Comments:55 (5 by maintainers)
Top Results From Across the Web
Why my javascript isn't working? - Stack Overflow
js file in the beginning in the head tag, javascript is not working. Why? All my javascript do, is counting symbols. $('#field1').keyup(function ...
Read more >Why won't my code work!? - The Beginner's Guide to Fixing ...
If your JavaScript code isn't working, use this handy checklist to find (and fix) the bugs.
Read more >Why is JavaScript not working with my HTML? - Quora
The most possible reason is browser cache. Refresh your html by Ctrl+F5 (this will clear the cache and re-read the linked files). Also...
Read more >Handling Events :: Eloquent JavaScript
There are specific event types fired by touch interaction. When a finger starts touching the screen, you get a "touchstart" event. When it...
Read more >Handling common JavaScript problems - MDN Web Docs
... getting modern JavaScript features working in older browsers, and more. ... if it isn't, you could then run code to load a...
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
Same here, building hangs forever when using the
captureAfterDocumentEvent
I tried moving the event from beforeMount to created, but neither seems to work.
I was having a similar problem, but I’m not using webpack-simple.
If you are NOT using webpack-simple (i.e. you have a build/webpack.prod.conf.js file), this should work: https://alligator.io/vuejs/vue-prerender-prerenderer/
Basically, you can use the NEXT version of prerender-spa-plugin and enjoy the renderer option.
NOTE: “SPA” is all caps in this: const PrerenderSPAPlugin = require(‘prerender-spa-plugin’)
BUT YOU PROBABLY NEED TO CHANGE
TO:
This worked for me. I hope this eases your pain. The next version of this plugin looks good.