We‘re sorry but XX doesn‘t work properly without JavaScript enabled. Please enable it to continue

We're sorry but XX doesn't work properly without JavaScript enabled. Please enable it to continue

question

Vue project, the return information prompt is "We're sorry but [project name] doesn't work properly without JavaScript enabled. Please enable it to continue.

Summarize the solutions searched online:

1、mode类型
前端修改方式:将mode类型由history改成hash;
后端修改方式:mode还是history,后端配置nginx,设置映射关系
2、publicpath路径问题
publicpath需要绝对路径’/’
3、本地开发,服务代理信息
检查代理信息是否有误,是否写有多个代理

None of the methods I searched on the Internet solved the problem I encountered.

Finally, we checked the problem and found the problem of vue-router configuration.

Solution

Routing configuration in case of error

const routes = [
  {
    
    
    path: '/',
    redirect: '/search',
    children: [
      {
    
    
        path: '/search',
        name: 'search',
        component: solve => require(['@/views/search/search-page.vue'], solve)
      }
    ]
  }
]
export default routes

insert image description here

Configuration after change

const routes = [
  {
    
    
    path: '/',
    redirect: '/search'
  },
  {
    
    
    path: '/search',
    name: 'search',
    component: solve => require(['@/views/search/search-page.vue'], solve)
  }
]

export default routes

insert image description here

Guess you like

Origin blog.csdn.net/heshuncheng/article/details/107927727