e20*_*200 0 static-html nuxt.js
我有一个 nuxt 网站,其中有一个unsupported page. 我注意到当我只想显示一个没有外部请求的静态页面时,Nuxt 正在加载它的文件,因为它是一个简单的页面,没有理由加载所有那一堆文件。
所以问题是:当访问 Nuxt 特定路由时,如何提供静态 HTML 文件,例如:/unsupported.
现在我正在使用空布局提供页面:
\n\n<template>\n <div class="unsupported">\n <div class="container">\n <i class="unsupported-icon fa fa-frown-o" />\n\n <h1>Seu navegador n\xc3\xa3o \xc3\xa9 suportado</h1>\n <h2>Para usar o Cinemax, n\xc3\xb3s recomendamos que use a vers\xc3\xa3o mais recente do <a href="#">Firefox</a>, <a href="#">Chrome</a> ou <a href="#">Safari</a></h2>\n </div>\n </div>\n</template>\n\n<script>\nexport default {\n layout: \'empty\'\n}\n</script>\n\n<style lang="scss">\n.unsupported {\n display : flex;\n flex-direction : column;\n justify-content: center;\n align-items : center;\n\n &-icon {\n font-size: 4rem;\n }\n}\n</style>\nRun Code Online (Sandbox Code Playgroud)\n\n但我需要它只是一个普通的 HTML 页面。
\n抱歉,我没有太注意文档中的部分,该部分说如果您想提供静态文件,只需将它们放入/static项目文件夹中即可。就我而言/static/unsupported.html,然后像这样访问它http://localhost:8000/unsupported.html
| 归档时间: |
|
| 查看次数: |
4287 次 |
| 最近记录: |