<template>
  <span class="btn" v-bind="$attrs" @click="btnClick">申请方案</span>
</template>

<script>
export default {
  name: "applyBtn",
  props: {
    myType: {
      type: String,
      default: 'kaoshi'
    },
  },
  methods: {
    // 判断是否为移动端
    isPC() {
      const browserWidth = document.documentElement.clientWidth;
      if (browserWidth <= 768) {
        return false;
      } else {
        return true;
      }
    },
    btnClick() {
      if (this.isPC()) {
        this.$emit('active-pc', this.myType)
      } else {
        this.$emit('active-h5', this.myType);
      }
    }
  }
}
</script>

<style lang="scss" scoped>
.btn {
  width: 154px;
  height: 47px;
  background: #00b96b;
  border-radius: 24px;
  padding: 10px 30px;
  color: #fff;
  cursor: pointer;
  @media (max-width: 768px) {
    width: 44%;max-width: 100px;margin: 0 3%;
  }
}
</style>
