<template>
  <el-menu
      class="full-width-menu"
      style="border: none; width: 100%"
      :default-active="activeIndex"
      @select="handleSelect"
  >
    <el-menu-item v-for="(item,index) in activities" :index="`${item.path}`" :key="index" class="sm:w-[170px] w-full" style="border-bottom: 1px solid #f3f3f3;">
      <span class="text-center w-full" @click="navigateTo(item.path)">{{ item.name }}</span>
    </el-menu-item>
  </el-menu>
</template>

<script setup lang="ts">
import {navigateTo} from "#imports";

  withDefaults(
    defineProps<{
      layout?: any;
      activeIndex?: string;
    }>(),
    {}
);

const emit = defineEmits<{
  (e: 'done', index: string): void;
  (e: 'update:visible', visible: boolean): void;
}>();

const activities = [
  {
    name: '账号信息',
    path: '/user'
  },
  {
    name: '密码修改',
    path: '/user/password'
  },
  {
    name: '实名认证',
    path: '/user/auth'
  },
  {
    name: '订单列表',
    path: '/user/order'
  },
  {
    name: '退出登录',
    path: '/user/logout'
  },
]


const handleSelect = (index: string) => {
  emit('done', index)
}

</script>
