我正在使用vue-router
在我的网站中构建路线,我试图以coreui does it的相同方式设置路线文件。我目前收到错误“ [vue-router]路由配置component" for path: / cannot be a string id. Use an actual component instead
。
./ src / router / index.js
import Vue from 'vue';
import Router from 'vue-router';
// Containers
const DefaultContainer = '../containers/DefaultContainer';
// Componenets
// const Navbar = '../components/Navbar';
// Views
const Home = '../views/Home';
const PageNotFound = '../views/404';
// Routes
Vue.use(Router)
export default new Router ({
mode: 'hash',
routes: [
{
path: '/',
redirect: '/home',
name: 'Home | Portfolio | Tom Dickson',
component: DefaultContainer,
children: [
{
path: 'home',
name: 'Home | Portfolio | Tom Dickson',
component: Home
}
]
},
{
path: '*',
component: PageNotFound
}
]
})
答案 0 :(得分:0)
嗯...回到它身边,就在我的面前:
已更改
// Containers
const DefaultContainer = '../containers/DefaultContainer';
收件人
// Containers
const DefaultContainer = () => import('../containers/DefaultContainer');
然后更新了我的其余观点...