【问题标题】:vue page not found after build构建后找不到vue页面
【发布时间】:2017-09-16 05:55:14
【问题描述】:

我与

有路线
    http://localhost:8080/user/reset

当我在开发时它可以找到 但是在构建之后我把 dist 放在 localhost

    http://localhost/user/reset

它说找不到页面。 但是我可以通过单击路由器链接从主页访问它,但不能通过浏览器中的直接地址访问它。

     {
        path: '/user/reset',
        component: function(resolve) {
            require(['@/components/view/reset.vue'], resolve)
        }
    }

这是我在 routes.js 中的路径

【问题讨论】:

    标签: npm vue.js vuejs2 vue-router


    【解决方案1】:

    我忘了放 .htaccess 文件。

    <IfModule mod_rewrite.c>
     RewriteEngine On
     RewriteBase /
     RewriteRule ^index\.html$ - [L]
     RewriteCond %{REQUEST_FILENAME} !-f
     RewriteCond %{REQUEST_FILENAME} !-d
     RewriteRule . /index.html [L]
    </IfModule>
    

    更多详情... https://router.vuejs.org/en/essentials/history-mode.html

    【讨论】:

      猜你喜欢
      • 2021-07-20
      • 2019-02-07
      • 2020-01-15
      • 2020-03-01
      • 2021-06-05
      • 1970-01-01
      • 2019-01-09
      • 1970-01-01
      • 2021-11-27
      相关资源
      最近更新 更多