官方仓库/文档
安装依赖 npm i puppeteer
npm i puppeteer
123456789101112131415
const puppeteer = require('puppeteer');(async () => { const browser = await puppeteer.launch(); const page = await browser.newPage(); await page.setViewport({ width: 750, height: 5000, deviceScaleFactor: 1, }); await page.goto('http://kaige.org'); await page.screenshot({path: 'example.png'}); await browser.close();})();
打算将小程序海报生成由puppeteer截图来做
puppeteer