の歴史は、私はアプリのURLからハッシュ(#)を取り除くしたい:ページは、ルータモードでロードされない:Apacheの
http://localhost/CoreUI-Vue/Vue_Starter/dist/#/dashboard
http://localhost/CoreUI/Vue_Starter/dist/dashboard
ので、私はvue-router
でmode
オプションを変更しましたhash
からrouter/index.js
でhistory
へ:
import Vue from 'vue'
import Router from 'vue-router'
Vue.use(Router)
export default new Router({
mode: 'history',
が、その後、私はrecompilとき私は実現
<body class="app header-fixed sidebar-fixed aside-menu-fixed aside-menu-hidden">
<div class="app">
(...app content...)
</div>
<script type="text/javascript" src="./static/js/manifest.a2cf3e09f095de958e46.js"></script>
<script type="text/javascript" src="./static/js/vendor.dfb9d96e757ce802aece.js"></script>
<script type="text/javascript" src="./static/js/app.72b651a6c3b2660db094.js"></script>
</body>
:問題なくアプリmode: 'hash'
(http://localhost/CoreUI/Vue_Starter/dist/#/dashboard
)負荷でルータのに対し
<body class="app header-fixed sidebar-fixed aside-menu-fixed aside-menu-hidden">
<!---->
<script type="text/javascript" src="./static/js/manifest.7c717a1bcc0cc7dc29c1.js"></script>
<script type="text/javascript" src="./static/js/vendor.dfb9d96e757ce802aece.js"></script>
<script type="text/javascript" src="./static/js/app.1cbf93c84add6c85b943.js"></script>
</body>
:ソースコード(npm run build
を)編とアプリ(http://localhost/CoreUI/Vue_Starter/dist/dashboard
)を開いて、それが空のページをロードこの追加の設定は、これを動作させるためにWebサーバーに提供する必要がありますが、それでも私を助けてくれませんでした。私は(vue-router docsからコピー).htaccess
における歴史ルータのサポートを提供
LoadModule rewrite_module modules/mod_rewrite.so
:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase/
RewriteRule ^index\.html$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.html [L]
</IfModule>
.htaccess
は同じに位置している私はmod_rewriteのがオンになっている保証はApacheのconfig httpd.conf
で
フォルダをプロジェクトのindex.html
として保存します。
私は空で作業していますCoreUI-Vue最も普及しているWebpack/Vue boilerplateを使用しているテンプレートなので、私のコードや設定については特別なことはありません。
これを試すサーバーを持っていないのですが、 'RewriteBase'は'/CoreUI/Vue_Starter/dist/'にする必要があります。 –