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中注册这个被引入的路由。已经完成。