import React, { useEffect } from "react"; import { observer } from "mobx-react"; import { Button, Drawer, Space } from "antd"; import type { DrawerProps } from "antd/es/drawer"; import { DownloadOutlined, PrinterOutlined } from "@ant-design/icons"; import { useMobStore } from "@/hooks"; import { toJS } from "mobx"; import styles from "./index.less"; import Trans from "@/utils/locale"; interface IProps extends DrawerProps {} const Index: React.FC = observer((props) => { const store = useMobStore("hiprintStore"); useEffect(() => { console.log("draw", toJS(store)?.hiprintTemplate?.getHtml()); props.open && $("#preview_content_design").html(toJS(store)?.hiprintTemplate?.getHtml()); return () => {}; }, [props.open]); const print = () => { store?.hiprintTemplate.print( {}, {}, { callback: () => { console.log("callback"); } } ); }; const toPdf = () => { store?.hiprintTemplate.toPdf({}, "打印预览"); }; return ( } >
); }); export default Index;