猿问
回到首页
个人中心
反馈问题
注册登录
下载APP
首页
课程
实战
体系课
手记
专栏
慕课教程
如何从 CUrl 下载或导出 PHP 中的 PDF 并输出到 VUE JS?
这是我的代码使用 CURL 的响应输出,我想知道如果可能的话,我将使用什么来将其响应为 JSON。或其他解决方案。
肥皂起泡泡
浏览 127
回答 1
1回答
侃侃无极
您可以使用 iframe 来显示 PDF 内容。在您的模板中:<iframe v-if="pdf" :src="`${pdf}`" width="100%"> 'This browser does not support PDFs. Please download the PDF to view it:' <a :href="`your link to the pdf`" >'Download PDF'</a></iframe>在你的脚本中:methods: { previewPDFReport () { this.pdf = null axios.get('your link to the pdf') .then(res => res.data) .then(data => { let blob = new Blob([data], { type: 'application/pdf' }) let url = window.URL.createObjectURL(blob) this.pdf = url }) }}
0
0
0
打开App,查看更多内容
随时随地看视频
慕课网APP
相关分类
PHP
php如何把参数放在Http Request Heade????
1 回答
继续浏览精彩内容
慕课网APP
程序员的梦工厂
打开
继续