node.js - vue專案build後,開啟監聽port沒問題,但重新整理頁面後就掛掉了
開發環境下跑起來都沒問然後npm run build後,打開監聽port沒問題,

#但是刷新頁面後就掛掉了,刷新後就如下圖

#然後我改了下mian.js中的程式碼,build後刷新頁面不會掛掉,但我不知道為什麼
修改前
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | <code>let router = new VueRouter({
mode: 'history' ,
routes: [
{
path: '/' ,
component: goods
},
{
path: '/goods' ,
component: goods
},
{
path: '/ratings' ,
component: ratings
},
{
path: '/seller' ,
component: seller
}
],
linkActiveClass: 'active'
})</code>
|
修改後
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | <code> const routes = [{
path: '/' ,
redirect: '/goods'
}, {
path: '/goods' ,
component: goods
}, {
path: '/ratings' ,
component: ratings
}, {
path: '/seller' ,
component: seller
}];
const router = new VueRouter({
linkActiveClass: 'active' ,
routes
});
</code>
|
修改後的url多了一個#的原因嗎?

#