这是main.js
import Vue from 'vue'
import projectView from './component/menu.vue'
import routerPath from './router.js'
new Vue({
router: routerPath,
el: '#coco',
components: { projectView }
});
这是router.js
import Vue from 'vue'
import router from 'vue-router'
import pageManage from './component/page.vue'
Vue.use(router)
var routerPath = new router({
base: __dirname,
routes: [{
path: '/page',
component: pageManage
}]
})
export default routerPath
这是引用路由的地方
<template>
<div style="width:100%;height:100%;">
<div class="menu_contain">
<router-link to="/page" class="menu_level_one">Go to page</router-link>
</div>
<div class="app_view">
<router-view></router-view>
</div>
</div>
</template>
页面渲染没问题,点击go to page 报错
实在不知道为啥了,求大神帮忙看一眼,O(∩_∩)O谢谢
这是page.vue里面的js部分
export default {
}
这是更改之后的router.js
import Vue from 'vue'
import router from 'vue-router'
import pageManage from './component/page.vue'
Vue.use(router)
var routerPath = new router({
})
export default routerPath
楼上各位提醒了我,自己着实是蠢了一把,没给组件传数据....,谢谢各位的热心解答:)