<template>
  <div class="container">
    <!-- <h1>xuefuMyTag</h1> -->
    <div
      class="tagBox"
      @click="goSingleTagPage(item.tagId, item.tag, item.num)"
      v-for="(item, index) in allTag"
      :key="index"
    >
      <div>{{ item.tag }}</div>
      <div>{{ item.num }}人</div>
      <!-- <div>{{ item.tagId }}</div> -->
    </div>
  </div>
</template>

<script>
import { allTag } from "@/api/cso";
export default {
  name: "xuefuMyTag",
  data() {
    return {
      allTag: ""
    };
  },
  methods: {
    getAllTag() {
      allTag().then(res => {
        // console.log(res, "allTag");
        this.allTag = res.data;
        console.log(this.allTag, "this.allTag");
      });
    },
    goSingleTagPage(id, tag, num) {
      //   console.log(tag, "goSingleTagPage");
      this.$router.push({
        path: "/pms/xuefuSingleTagPage",
        query: {
          //   id: id
          tagId: id,
          tag: tag,
          num: num
        }
      });
    }
  },
  mounted() {
    this.getAllTag();
  }
};
</script>

<style lang="scss" scoped>
.container {
  display: flex;
  //   flex-direction: column;
  padding: 20px;
}
.tagBox {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  width: 100px;
  height: 100px;
  background-color: #3498db;
  box-sizing: border-box;
  //   padding: 10px;
  margin: 10px;
  border-radius: 20px;
  box-shadow: 0 0 5px #333;
  transition: 0.5s;
  cursor: pointer;
  &:hover {
    transform: scale(1.1);
  }
  div {
    margin: 3px;
  }
}
</style>
