我正在使用phantomjs从html生成pdf。该网页是用react编写的,我猜它对于phantomjs来说太新了,因为我遇到了错误:
http://127.0.0.1:3000/static/js/1.chunk.js:150649
ReferenceError: Can't find variable: fetch
如何将页面解析为旧js?这是代码:
var system = require('system');
var page = require('webpage').create();
page.open("http://127.0.0.1:3000/home", function () {
window.setTimeout(function () {
page.render('/opt/report.pdf');
phantom.exit();
}, 100000);
});