fix(ResearchReport): dynamically import print-js
This commit is contained in:
@ -1,5 +1,4 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import printJS from 'print-js'
|
|
||||||
import { marked } from 'marked'
|
import { marked } from 'marked'
|
||||||
import { writeFinalReport } from '~/lib/deep-research'
|
import { writeFinalReport } from '~/lib/deep-research'
|
||||||
import {
|
import {
|
||||||
@ -34,6 +33,8 @@
|
|||||||
loadingExportMarkdown.value,
|
loadingExportMarkdown.value,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
let printJS: typeof import('print-js') | undefined
|
||||||
|
|
||||||
async function generateReport() {
|
async function generateReport() {
|
||||||
loading.value = true
|
loading.value = true
|
||||||
error.value = ''
|
error.value = ''
|
||||||
@ -88,6 +89,10 @@
|
|||||||
// Wait after title is changed
|
// Wait after title is changed
|
||||||
await new Promise((r) => setTimeout(r, 100))
|
await new Promise((r) => setTimeout(r, 100))
|
||||||
|
|
||||||
|
if (!printJS) {
|
||||||
|
printJS = (await import('print-js')).default
|
||||||
|
}
|
||||||
|
|
||||||
printJS({
|
printJS({
|
||||||
printable: reportHtml.value,
|
printable: reportHtml.value,
|
||||||
type: 'raw-html',
|
type: 'raw-html',
|
||||||
|
Reference in New Issue
Block a user