<template>
  <view class="shop" @tap="goCart">
    <view class="cu-tag badge" v-if="carts.includes(class_attend_id)"></view>
    <text class="cuIcon-cart text-student cart"></text>
  </view>
</template>

<script>
import { mapGetters } from 'vuex'
export default {
  props: {
    class_attend_id: {
      type: Number,
      default: 0
    },
    disableBtn: {
      type: Boolean,
      default: false
    }
  },
  data() {
    return {
      key: 1212
    }
  },
  computed: {
    ...mapGetters(['carts'])
  },
  methods: {
    goCart() {
      if (this.disableBtn) return false
      this.$emit('changeDisableBtn') // 改变按钮点击
      this.globalNavigateTo('classCart')
    }
  }
}
</script>

<style lang="scss" scoped>
.shop {
  position: relative;
}
.cart {
  font-size: 24px;
}
.cu-tag.badge {
  top: 2px;
}
</style>
