vue中在一个页面中引用另一个router-view

1.被引入的vue组件:

<template>
    <el-row :gutter="20" class="index">
        <el-col :xs="4">
            <div class="grid-content bg-purple-light">A</div>
        </el-col>
        <el-col :xs="4">
            <div class="grid-content bg-purple">B</div>
        </el-col>
        <el-col :xs="8">
            <div class="grid-content bg-purple-dark">C</div>
        </el-col>
        <el-col :xs="8">
            <div class="grid-content bg-purple">D</div>
        </el-col>
        <el-col :xs="{span:24,offset:0}" :sm="{span:16,offset:4}" :md="{span:12,offset:6}">
            <el-button type="success">e</el-button>
        </el-col>
    </el-row>
</template>

<script>
    export default {
        name: "index"
    }
</script>

<style lang="less" scoped>
    .el-col {
        border-radius: 4px;
    }

    .bg-purple-dark {
        background: blue;
    }

    .bg-purple {
        background: red;
    }

    .bg-purple-light {
        background: yellow;
    }

    .grid-content {
        border-radius: 4px;
        min-height: 36px;
    }

</style>

2在.主页面中进行引入:

<template>
	<div> <index></index></div>
</template>
<script>
	//import路由
    import index from '../components/main/Index.vue'
    export default {
    	//在components中命名路由的名称
        components: {
            index
        },
 </script>

3.不需要在router.js中注册这个被引入的路由。已经完成。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值