<component
is="BarChart"
></component>
component是动态渲染组件,其中is带的参数是注册组件的名字,通过名字去加载组件
<component
:is="item.name"
:isbool="moremodule"
:datas="item.datas"
@eventdblclick="handleUpdateEx"
@handleSetLineChartData="handleSetLineChartData"
></component>
OriLayoutArr: [
{
id: 10,
xs: 24,
sm: 24,
lg: 24,
datas: [],
name: "PanelGroup",
title: "数据统计",
},
{
id: 20,
xs: 24,
sm: 24,
lg: 24,
datas: [],
name: "DragModuleInfo",
title: "功能模块",
},
// {id:30, xs:24, sm:24, lg:24, datas:[], name:'LineChart', title:"学习曲线"},
// {id:40, xs:24, sm:24, lg:8, datas:[], name:'RaddarChart', title:"学生成绩分布"},
{
id: 50,
xs: 24,
sm: 24,
lg: 8,
datas: [],
name: "CategoryChart",
title: "用户登录情况",
},
// {id:60, xs:24, sm:24, lg:8, datas:[], name:'BarChart', title:"课程学习分布"},
{
id: 60,
xs: 24,
sm: 24,
lg: 8,
datas: [],
name: "GaugeChart",
title: "资源空间使用情况",
},
],
也可以通过以数组的形式去动态渲染组件并且带相对应的参数,以及数据,挺不错的方法