#然後我改了下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
});
vue-router文件-history後端設定