nuxt.js - 如何在 Nuxt 中加载静态 HTML 页面(避免 Nuxt 请求)
问题描述
我有一个 nuxt 网站,它有一个unsupported page
. 当我只想显示一个没有外部请求的静态页面时,我注意到 Nuxt 正在加载它的文件,因为它是一个简单的页面,没有理由加载所有这些文件。
所以问题是:我如何在访问 Nuxt 特定路由时提供静态 HTML 文件,例如:/unsupported
.
现在我正在为页面提供空布局:
<template>
<div class="unsupported">
<div class="container">
<i class="unsupported-icon fa fa-frown-o" />
<h1>Seu navegador não é suportado</h1>
<h2>Para usar o Cinemax, nós recomendamos que use a versão mais recente do <a href="#">Firefox</a>, <a href="#">Chrome</a> ou <a href="#">Safari</a></h2>
</div>
</div>
</template>
<script>
export default {
layout: 'empty'
}
</script>
<style lang="scss">
.unsupported {
display : flex;
flex-direction : column;
justify-content: center;
align-items : center;
&-icon {
font-size: 4rem;
}
}
</style>
但我需要它只是一个普通的 HTML 页面。
解决方案
抱歉,我不太注意文档中说如果要提供静态文件,只需将它们放入/static
项目文件夹中的部分。就我而言/static/unsupported.html
,然后像这样访问它http://localhost:8000/unsupported.html
推荐阅读
- python-3.x - Python:sqlalchemy - 仅映射结果
- html - 如果我点击标题中的关于按钮,如何直接进入我网站的关于部分?
- python - 在 matplotlib 中绘制三角函数的周期
- php - 404 未找到:带有参数的 laravel api
- android - android sdk 出错:无法计算完整的依赖项列表
- python - Python在不连接wifi时获取设备的MAC地址
- python - 连接两个数据框并将唯一值保存为 txt
- python - python - 在返回时将值附加到列表
- python - 有没有办法进一步减少 Python 可执行文件大小/使用 pyinstaller 以及 poppler 和 pytesseract?
- javascript - 在播种器脚本中播种 MongoDb NodeJS