@quarkunlimit/qu-print
TypeScript icon, indicating that this package has built-in type declarations

1.0.1 • Public • Published
import { useRef } from 'react'
import { quPrint } from '@quarkunlimit/qu-print'

function App() {
  const iframeRef = useRef()
  // printHtml
  const URL = ''
  const onLoad = () => {
    iframeRef.current = document.getElementById('iframeRef')
    const data = {
      hospitalName: '睿美云',
      time: '2022-05-12',
      newTime: '2022-05-12',
      dataSource: [
        {
          businessType: '预收款',
          totalMoney: '5000',
          itemCashPay: '200',
          itemCardPay: '125',
          itemVirtual: '575',
          itemStorePay: '100',
        },
        {
          businessType: '预收款',
          totalMoney: '4545',
          itemCashPay: '57845',
          itemCardPay: '1245',
          itemVirtual: '445',
          itemStorePay: '100',
        },
      ],
    }
    quPrint.getInstance().postRender(iframeRef.current, data, '*')
  }
  const onClick = () => {
    quPrint.getInstance().postPrint(iframeRef.current, '*')
  }
  return (
    <div className="App">
      <div>app</div>
      <button onClick={onClick}>打印</button>
      <iframe
        onLoad={onLoad}
        width={800}
        height={400}
        id="iframeRef"
        title="iframeRef"
        src={URL}
        frameBorder={0}
      />
    </div>
  )
}

export default App

Readme

Keywords

none

Package Sidebar

Install

npm i @quarkunlimit/qu-print

Weekly Downloads

1

Version

1.0.1

License

ISC

Unpacked Size

21.7 kB

Total Files

9

Last publish

Collaborators

  • hyyyyyyy
  • hanlike
  • kl.nevermore