📜  如何将 React 组件转换为图像 - Javascript 代码示例

📅  最后修改于: 2022-03-11 15:01:54.742000             🧑  作者: Mango

代码示例1
import { exportComponentAsJPEG, exportComponentAsPDF, exportComponentAsPNG } from 'react-component-export-image';
import React from 'react';

class ComponentToPrint extends React.Component {
 render() {
   return 
Hello World
; } } export default class MyComponent extends React.Component { constructor(props) { super(props); this.componentRef = React.createRef(); } render() { return ( ); } }