<template>
  <el-menu
      default-active="/home"
      style="height: 100vh;"
      class="el-menu-vertical-demo"
      background-color="#545c64"
      text-color="#fff"
      active-text-color="#ffd04b"
      :collapse="isCollapse"
      :collapse-transition="false"
      router
  >



    <el-menu-item :index="'/'+item.menuClick" v-for="(item,i) in menu" :key="i">
      <i :class="item.menuIcon"> </i>
      <span slot="title">{{item.menuName}}</span>
    </el-menu-item>
  </el-menu>
</template>

<script>
export default {
  name: "Aside",
  data(){
    return{
      ruleForm: {
        userNo: '',
        passWord: '',
      }
    }
  },
  mounted() {
    this.login()
  },
  methods: {
    login() {
      this.ruleForm.userNo="admin"
      this.ruleForm.passWord="123"

      this.$axios.post(this.$httpUrl + '/user/login', this.ruleForm).then(res => res.data)
          .then(res => {
            if (res.code == 200) {
              //存储
              sessionStorage.setItem("user", JSON.stringify(res.data.user))
             // console.log(res.data.menu)
              this.$store.commit("setMenu",res.data.menu)
              //跳转页面
              this.$router.push('/index')
            } else {
              this.$message.error(res.msg);
            }
          })
    }
  },
  computed:{
    "menu":{
      get(){
          return this.$store.state.menu
      }
    }
  },
  props:{
    isCollapse:Boolean
  }
}
</script>

<style scoped>

</style>
