import vueRouter from 'vue-router'
import router from './router/index.js' //路由定义文件
Vue.use(vueRouter)
//实例对象中挂载路由
var template=`<App></App>`
var app=new Vue({
el:"#app",
data:{'a':1},
render:h=>h(App),
router:router, //mount router
})
<template>
<router-view></router-view>
</template>
<script>
export default{
}
</script>
<style>
</style>
import vueRouter from "vue-router"
import indexPage from "./../components/index.vue"
const router=new vueRouter({
routes:[
{path:'/',component:indexPage}
]
})
export default router