【问题标题】:Reference HTML file in iframe with Quasar framework使用 Quasar 框架在 iframe 中引用 HTML 文件
【发布时间】:2021-04-07 07:57:13
【问题描述】:

我需要在 iframe 中打开一个静态 HTML 文件,因为我需要静默打印它,我正在尝试使用废弃和相对路径设置 iframe src,但它们都不起作用,我尝试将我的文件移动到里面public、static 和 assets 文件夹没有成功,我看到有些人使用 process.env.BASE_URL 来访问环境的绝对路径,但它在 Quasar 中不起作用。

目前我的文件位于根目录下的公共文件夹内名为 ticketTemplates 的文件夹中,它有两个文件:first.htmlfirst.css,我正在执行以下操作:

<iframe src="ticketTemplates/first.html" frameborder="1"></iframe>

但正如我之前所说,它不适用于相对或绝对路径。我也尝试过http://localhost:8080/ticketTemplates/first.html,但它不起作用。

你能告诉我如何实现吗?

【问题讨论】:

    标签: vue.js vuejs2 quasar-framework


    【解决方案1】:

    我在 Quasar 论坛 中打开了 thistread,发现我使用的是过时版本的 @quasar/app,我更新了我的项目并且内容在我的 iframe 中运行。 我将我的ticketTemplates 文件夹移动到位于根目录中的public 文件夹中,在quasar.conf.js 文件旁边,生成的代码是:

    <iframe src="http://localhost:8080/ticketTemplates/first.html" frameborder="1"></iframe>
    

    所有功劳都归功于帮助我的用户。

    【讨论】:

      猜你喜欢
      • 2022-07-01
      • 1970-01-01
      • 2012-10-05
      • 2020-04-12
      • 2020-05-03
      • 2020-02-17
      • 2018-10-22
      • 2021-05-26
      • 2022-11-07
      相关资源
      最近更新 更多