我在vuejs中有一个项目,我必须使用vue-html2pdf。
当我在标签<section>something</section>
中写入文本时,将生成我的PDF。但是,当我在标签<section><p>something</p></section>
中写入内容时,我的浏览器崩溃了。
这里是我在vuejs中的代码:
<vue-html2pdf
:show-layout="false"
:preview-modal="true"
:paginate-elements-by-height="10"
:filename="test"
:pdf-quality="2"
:pdf-format="size"
:ref="ref"
>
<section slot="pdf-content">
<section class="pdf-item">
<img :src=url>
</section>
</section>
</vue-html2pdf>
<button @click="generateReport">Download</button>
使用下面的代码,我的大量现金兑现。
还有我下载pdf的功能:
generateReport () {
this.$refs.html2Pdf.generatePdf()
},
感谢您的回答和帮助。
vue-html2pdf
npm模块无法正常工作。而不是您可以尝试使用html2pdf
模块在vuejs
中将html转换为pdf。