简体   繁体   English

阻止Vuejs应用程序重写URL

[英]Prevent Vuejs application from rewriting URL

I have a Java web application which runs on a JBoss server on: http://192.168.0.115:8080/war-name-goes-here/ . 我有一个Java Web应用程序,该应用程序可在http://192.168.0.115:8080/war-name-goes-here/上的JBoss服务器上运行。 I'm trying to convert the .jsp pages into a SPA using Vuejs, but I notice that when I run the Vuejs application it overwrites the URL and it converts to just: http://192.168.0.115:8080 . 我正在尝试使用Vuejs将.jsp页面转换为SPA ,但是我注意到当我运行Vuejs应用程序时,它会覆盖URL并转换为: http : //192.168.0.115 : 8080 Is this a normal behavior of a Vuejs application run on a Java back-end or should I change any configuration of the server? 这是在Java后端上运行的Vuejs应用程序的正常行为,还是我应该更改服务器的任何配置? Thnx! 谢谢!

The base URL of the app is '/' by default. 该应用的基本网址默认为'/'

So add base option to you router constructor options 因此,将base选项添加到路由器构造器选项中

const router = new VueRouter({
  base: "/war-name-goes-here/",
  routes
})

Reference - Router construction options 参考- 路由器构造选项

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM