<template> <div> <menu-component class="monitor_menu" :menuList="list" :active="active"></menu-component> </div> </template> <script> import menuComponent from '../components/menu-component' import { mapState } from 'vuex' export default { data() { return { list: [], active: '' } }, components: { menuComponent }, computed: { ...mapState('d2admin/menu', [ 'header' ]) }, created () { this.header.forEach(res => { if (res.path === '/alarms') { this.list = res.list this.active = res.list[0].path this.$router.push({ path: res.list[0].path }) } }) } } </script>