Vue中父组件传子组件

父组件代码:

<template>
<section :class="menuMode === 'vertical' ? 'vertical-sub-nav' : 'sub-nav'">
<el-menu :mode="menuMode" :default-active="defaultActive" :current-tab="currentTab" @select="handleSelect">
<el-menu-item v-for="(data,ind) in subNavData[currentTab]" :index="data.i" :key="ind">
<span class="p5">
{{data.title}}
</span>
</el-menu-item>
</el-menu>
</section>
</template>
<script>
export default {
name: 'NavMenu',
data() {},
props: {
menuMode: {
type: String,
default: 'horizontal'
},
defaultActive: {
type: String,
default: '0'
},
currentTab: {
type: String,
default: '0'
}
}
}
</script>

子组件代码:

<mp-subnav default-active="0" current-tab="0"></mp-subnav>
上一篇:《精通移动app测试实战:技术、工具和案例》新书上市


下一篇:python中os模块操作目录与文件名小结