欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

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

程序员文章站 2022-04-16 23:53:14
...

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

问题

vue项目,返回信息提示为“We’re sorry but [项目名称] doesn’t work properly without JavaScript enabled. Please enable it to continue.

汇总一下网上搜索的解决方法:

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

网上搜索的方法均未解决我遇到的问题。

最后排查问题,发现vue-router配置的问题。

解决方法

发生错误时的路由配置

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

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

更改之后的配置

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

export default routes

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

相关标签: Vue vue