文章詳情頁
node.js - vue項目build后,打開監聽port沒問題,但是刷新頁面后就掛掉了
瀏覽:111日期:2023-09-21 16:28:48
問題描述
開發環境下跑起來都沒問然后npm run build后,打開監聽port沒問題,然后我改了下mian.js中的代碼,build后刷新頁面不會掛掉,但是我不知道為什么
修改前let router = new VueRouter({mode: ’history’,routes: [{path: ’/’,component: goods},{path: ’/goods’,component: goods},{path: ’/ratings’,component: ratings},{path: ’/seller’,component: seller}],linkActiveClass: ’active’})
修改后
const routes = [{ path: ’/’, redirect: ’/goods’}, { path: ’/goods’, component: goods}, { path: ’/ratings’, component: ratings}, { path: ’/seller’, component: seller}];const router = new VueRouter({ linkActiveClass: ’active’, routes});修改后的url多了一個#的原因嗎?
問題解答
回答1:vue-router文檔-history后端配置
標簽:
vue
排行榜
