<template>
  <div id="menus">
    <el-menu :default-active="thisRouter()" class="el-menu-vertical-demo" :router="false" :default-openeds="defalutMenu" @select="to">
      <el-menu-item index="/"> <i class="el-icon-s-grid"></i>首页 </el-menu-item>
      <el-menu-item index="/test/index"> <i class="el-icon-s-grid"></i>测试菜单</el-menu-item>
      <!-- <el-submenu index="1">
        <template v-slot:title>
          <i class="el-icon-s-grid"></i>
          <span>测试菜单1</span>
        </template>
        <el-menu-item-group>
          <el-menu-item index="/test2/index">测试菜单1</el-menu-item>
        </el-menu-item-group>
      </el-submenu> -->
    </el-menu>
  </div>
</template>

<script>
export default {
  name: 'menus',
  props: {},
  components: {},
  data: () => ({
    // defalutMenu: ['1', '2', '3'],
    defalutMenu: [],
    defalutPage: '',
  }),
  created() {},
  computed: {},
  methods: {
    thisRouter() {
      console.log(this.$route.path);
    },
    to(index) {
      this.$router.push({ path: index });
    },
  },
};
</script>

<style lang="less" scoped></style>
