我在vuejs项目中使用了prerender-spa-plugin做预渲染,代码如下
new PrerenderSPAPlugin({
staticDir: path.join(__dirname, '../dist'),
routes: ['/', '/help/fee', '/help/mnemonic', '/help/agreement', '/help/privacy', '/help/support', '/help/transaction-fail'],
}),
现在的情况是打包出来貌似没有问题,html里面的内容也确实预渲染了,如图
但是运行项目发现页面引用的css有效,但JS全都无效,包括状态不会变化,dom绑定的事件不能触发等,求大神解答
看一下你预渲染打包出来的html是不是少了id="app"的元素
一般来说main.js里面是挂载到id="app"的元素上的