使用 VueJS 打开 PDF [英] Open a PDF using VueJS

查看:22
本文介绍了使用 VueJS 打开 PDF的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我希望能够在 VueJS 上打开 pdf.pdf文件是本地的,不能在线.

I want to be able to open a pdf on VueJS. The pdf file is local and cannot be online.

(我使用 Quasar 的按钮,但它的功能与 HTML 按钮相同)

(I'm using Quasar's button but it functions the same as a HTML button)

我试过了:

<q-btn id="mebtn" href="../assets/resume.pdf">Click Me</q-btn> 

<input type="button" value="Open" onClick="window.open('../assets/Resume.pdf');

我遇到的错误:

无法获取../assets/Resume.pdf

Cannot GET ../assets/Resume.pdf

我希望能够单击按钮,然后我的 pdf 会在另一个选项卡上弹出

I want to be able to click the button and then my pdf pops up on another tab

其他普通的 html 解决方案将不起作用

推荐答案

在 VueJS 中,有一个名为static"或statics"的文件夹,您只需将文件移动到statics"即可访问通过本地目录.

In VueJS, there's a folder called "static" or "statics" and all you have to do is move the file to "statics" to be able to access it through local directory.

这篇关于使用 VueJS 打开 PDF的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆