修复图片生成失败 (#258)
This commit is contained in:
parent
4169d3d23d
commit
4f1f3c2105
|
@ -5,7 +5,7 @@ import Renderer from '../renderer/loader.js'
|
|||
* 后期会逐步废弃
|
||||
* 只提供截图及分片截图功能
|
||||
*/
|
||||
let renderer = Renderer.getRenderer('puppeteer')
|
||||
let renderer = Renderer.getRenderer()
|
||||
renderer.screenshot = async (name, data) => {
|
||||
let img = await renderer.render(name, data)
|
||||
return img ? segment.image(img) : img
|
||||
|
|
|
@ -5,8 +5,8 @@ import puppeteer from 'puppeteer'
|
|||
// 暂时保留对原config的兼容
|
||||
import cfg from '../../../lib/config/config.js'
|
||||
import { Data } from '#miao'
|
||||
import path from 'path'
|
||||
|
||||
const _path = process.cwd()
|
||||
// mac地址
|
||||
let mac = ''
|
||||
|
||||
|
@ -176,7 +176,7 @@ export default class Puppeteer extends Renderer {
|
|||
try {
|
||||
const page = await this.browser.newPage()
|
||||
let pageGotoParams = lodash.extend({ timeout: 120000 }, data.pageGotoParams || {})
|
||||
await page.goto('file://' + path.resolve(savePath), pageGotoParams)
|
||||
await page.goto(`file://${_path}${lodash.trim(savePath, '.')}`, pageGotoParams)
|
||||
let body = await page.$('#container') || await page.$('body')
|
||||
|
||||
// 计算页面高度
|
||||
|
|
Loading…
Reference in New Issue