undefinedfix
Sign in

Before the deployment of Vue project, it is possible to access various components by routing and jumping. After the deployment to springboot, the whitelabel error page error appears?

allie_kovacevich edited in Sat, 24 Sep 2022

The problem may be that springboot executed the URL of the page jump as a request, resulting in the whitelabel error page error. When Vue is not deployed, different components can be switched according to the URL. After deploying to springboot, only "/" Can be accessed. The rest are inaccessible. Online waiting for help

//router.js
import Vue from 'vue'
import Router from 'vue-router'
import OOTmnlCollRateAnaly from '../components/appList/objectOrientedTmnlCollRateAnaly'
import speLineCollDeAll from '../components/appList/speLineCollDeAll'
import speLineCollDeEach from '../components/appList/speLineCollDeEach'
Vue.use(Router)

export default new Router({
  routes: [
    {
      path: '/',
      name: 'mainPage',
      component: OOTmnlCollRateAnaly,
    },
    {
      path: '/tmnlCollAnaly',
      name: 'tmnlCollAnaly',
      component: OOTmnlCollRateAnaly
    },
    {
      path: '/speLineCollDeAll',
      name: 'speLineCollDeAll',
      component: speLineCollDeAll
    },
    {
      path: '/speLineCollDeEach',
      name: 'speLineCollDeEach',
      component: speLineCollDeEach
    }
  ],
  mode:'history' //去掉路径的'#'
})
//main.js 程序入口文件,是初始化vue实例并使用需要的插件,加载各种公共组件.
import Vue from 'vue' //引入模块vue
import VueRouter from 'vue-router'
import router from './router/router' //引入route文件
import ElementUI from 'element-ui'//引入模块element
import 'element-ui/lib/theme-chalk/index.css' //这里引入饿了么的UI框架
import componentsContainer from './components/componentsContainer.vue'

import vue_header_public from './components/header/header.vue'

Vue.config.productionTip = false  //对引入的vue模块进行设置

Vue.use(VueRouter)
Vue.use(ElementUI)

new Vue({
  el: '#vue_header_public',
  components: { vue_header_public },
  template: '<vue_header_public/>'
})

new Vue({
  router,
  el:'#componentsContainer',
  render:h =>h(componentsContainer)
})
//页面中跳转的方法
    methods: {
      openPageOOBTmnlAnalysis: function ()
      {
        window.location.href="tmnlCollAnaly";
      },
2 Replies
bomny
commented on Sat, 24 Sep 2022

Do you use Vue router for page Jump, or static resource path problem https://cli.vuejs.org/zh/conf...

eqimj
commented on Sat, 24 Sep 2022

Springboot static resource configuration is set to: if the static resource cannot be found in the current request path, return/ index.html

The following is the nginx configuration, and spring boot is the same principle

location / {
    try_files $uri /index.html;
}