我正在尝试使用phantomjs-node捕获屏幕。在我的组件中,我导入const phantom = require('phantom');
。然后点击后我想运行方法 -
printOnePage(){
phantom.create().then(function(ph) {
ph.createPage().then(function(page) {
page.open('https://stackoverflow.com/').then(function(status) {
console.log(status);
page.property('content').then(function(content) {
console.log(content);
page.close();
ph.exit();
});
});
});
});
}
但我仍然得到错误 -
webpack:///./~/phantomjs-prebuilt/lib/phantomjs.js?:8 Uncaught Error: Cannot find module "fs"(…)
任何提示怎么办?