zhangzengfei
2022-08-22 f14f98a263141d2f8ec0079866a758cc7a1c38d1
src/views/personalCenter/components/LeftMenu.vue
@@ -1,17 +1,17 @@
<template>
  <div class="left-menu">
    <div class="user-img">
      <img src="/images/hashrate/独立场景空页面.png" alt="" />
      <img src="/images/hashrate/s_empty.png" alt="" />
    </div>
    <div class="user-name">{{ userInfo.username }}</div>
    <div class="menu-list">
      <div
        class="item"
        @click="pickMenu(index)"
        v-for="(item, index) in menuList"
        :key="index"
        :class="index == activeIndex ? 'active-item' : ''"
        @click="pickMenu(index, item.tab)"
      >
        <span class="iconfont">&#xe614;</span>
        <span class="item-name"> {{ item.name }}</span>
@@ -23,28 +23,31 @@
<script>
export default {
  created() {
    this.userInfo = JSON.parse(sessionStorage.getItem("userInfo"));
    this.userInfo = JSON.parse(sessionStorage.getItem("userInfo"))
    if (this.$route.query && this.$route.query.id) {
      this.activeIndex = this.$route.query.id
    }
  },
  data() {
    return {
      menuList: [
        { name: "账户总览" },
        { name: "订单管理" },
        { name: "消息中心" },
        { name: "基本资料" },
        { name: "子账户管理" },
        // { name: "账户总览" },
        // { name: "订单管理" },
        // { name: "消息中心" },
        { name: "基本资料", tab: "baseInfo" },
        { name: "子账户管理", tab: "subAccount" }
      ],
      userInfo: null,
      activeIndex: 0,
    };
      activeIndex: 0
    }
  },
  methods: {
    pickMenu(i) {
      this.activeIndex = i;
      this.$emit("mChange", i);
    },
  },
};
    pickMenu(idx, tab) {
      this.activeIndex = idx
      this.$emit("mChange", tab)
    }
  }
}
</script>
<style scoped lang="scss">
@@ -91,4 +94,4 @@
    }
  }
}
</style>
</style>