qq15725 / modern-screenshot

📸 Quickly generate image from DOM node using HTML5 canvas and SVG
https://toolpkg.com/html-to-image
MIT License
588 stars 38 forks source link

设置style选项时报错 #58

Closed flycran closed 10 months ago

flycran commented 10 months ago

设置style选项时报错

const dataUrl = await domToJpeg(node, {
    scale: 2,
    style: `
      #a {
        width: 175px;
      }
    `,
  })
TypeError: Failed to set an indexed property [0] on 'CSSStyleDeclaration': Indexed property setter is not supported.
qq15725 commented 10 months ago

style 目前只支持对象方式的 CSSStyleDeclaration 结构,还不支持 cssText 方式