1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
| <template>
| <template v-for="(item,index) in menus" :key="item[propsId]+'#'+index">
| <el-sub-menu v-if="item[propsChildren]&&item[propsChildren].length>0" :index="item[propsId]">
| <template #title>
| <i v-if="item[propsIcon]" class="iconfont" :class="['icon-'+item[propsIcon]]"></i>
| <span>{{item[propsText]}}</span>
| </template>
| <sub-menus-compontent :menus="item[propsChildren]" :props-id="propsId" :props-text="propsText" :props-children="propsChildren" :props-icon="propsIcon" />
| </el-sub-menu>
| <el-menu-item v-else :index="item[propsId]">
| <i v-if="item[propsIcon]" class="iconfont" :class="['icon-'+item[propsIcon]]"></i>
| <span>{{item[propsText]}}</span>
| </el-menu-item>
| </template>
| </template>
|
| <script>
| export default {
| name:'subMenusCompontent',
| props:{
| menus:{
| type:Array,
| default:function(){
| return []
| }
| },
| propsId:{
| type:String,
| default:'id'
| },
| propsText:{
| type:String,
| default:'text'
| },
| propsChildren:{
| type:String,
| default:'children'
| },
| propsIcon:{
| type:String,
| default:'icon'
| }
| }
| }
| </script>
|
| <style>
| </style>
|
|