<template>
  <div id="native">
    <el-row>
      <el-col :span="24">
          <el-menu :default-active="activeIndex2" class="el-menu-demo" mode="horizontal" background-color="#336699"
                   text-color="#fff" active-text-color="#fff" style="height:40px;" :router="true">
            <template v-for="(item, index) in menu">
              <el-submenu :index="`${index}`" :key="index" v-if="item.type !== 'url' && item.type !== 'content'">
                <template slot="title">
                  {{ item.title }}
                </template>
                <template v-for="(sub, subIndex) in item.children">
                  <el-menu-item :index="`${index}-${subIndex}`" :key="subIndex+'sub'" v-if="sub.children"
                                style="float:left">
                    <template slot="title">
                      {{ sub.title }}
                    </template>
                  </el-menu-item>
                </template>
              </el-submenu>
            </template>
          </el-menu>
      </el-col>
    </el-row>
  </div>
</template>

<script>
import { mapActions, mapState, mapMutations } from 'vuex';
export default {
  name: 'native',
  props: {},
  components: {},
  data: () => ({

    activeIndex2: '',
  }),
  created() { },
  computed: {
    ...mapState(['menu']),
  },
  methods: {
    turnTo(url) {
      window.open(url);
    },
  },
};
</script>

<style lang="less" scoped>
/deep/.el-menu--horizontal > .el-submenu .el-submenu__title {
  height: 40px;
  line-height: 40px;
}
</style>
