Is there a way to route to html files with Vue router?(有没有办法使用 Vue 路由器路由到 html 文件?)
问题描述
Hello I am using VueJS and the webpack template. I have a bunch of components I can easily display with Vue Router. However, my organization uses Robot Framework for testing and we generate an HTML page using the command:
This is basically how I am using the router:
Is there a way to route to an HTML file using Vue Router?
First you'll need html-loader
:
Then you need to update your webpack.config.js
file and add an entry to your rules
to handle .html
extensions:
Then you can import your .html
files like you would components:
Now treat component
as an Object and leverage the template
property to serve static HTML files:
这篇关于有没有办法使用 Vue 路由器路由到 html 文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!