console
const block_1 = {
template: `
<span>block_11</span>
`
}
const block_2 = {
template: `
<span>block_22</span>
`
}
const block_3 = {
template: `
<span>block_33</span>
`
}
const layout = {
template: `
<div>
<p>layout</p>
<block_1/>
<block_2/>
<block_3/>
</div>
`,
components:{
block_1,
block_2,
block_3
}
}
const router = new VueRouter({
routes: [
{
path: '/',
components: {
default: block_1,
block_2: block_2,
block_3: block_3
},
children: [
{
path: '/setting',
components: {
default: block_1,
template2: block_2
}
}
]
}
]
})
new Vue({
el: '#app',
router,
})
<script src="https://unpkg.com/vue/dist/vue.js"></script>
<script src="https://unpkg.com/vue-router/dist/vue-router.js"></script>
<div id="app">
<router-view></router-view>
<router-view name="block_2"></router-view>
<router-view name="block_3"></router-view>
<router-link to='/'>layout</router-link>
</div>