(vue)子组件中事件结束后切换父组件的el-tab-pane
需求:
父组件
<el-tabs v-model="activeName" type="border-card" tab-position="left">
<el-tab-pane label="分析建模" name="1" :disabled="true" />
...
<el-tab-pane label="在线训练" name="4">
<OnlineTraining @activeNum="activeNum" /> //重点
</el-tab-pane>
<el-tab-pane label="任务列表" name="5">
<TaskManage />
</el-tab-pane>
...
</el-tabs>
...
activeNum(val) {
this.activeName = val;
},
子组件
executDialogForm() {
this.$emit("activeNum", "5");
},
解决参考:https://blog.csdn.net/qq_52863420/article/details/121844984