<template>
  <div class="container">
    <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: "myTag",
  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/singleTagPage",
        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;
  border: 3px solid #3498db;
  color: #3498db;
  font-weight: bold;
  // box-sizing: border-box;
  padding: 5px 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>
