applyBtn.vue 814 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. <template>
  2. <span class="btn" v-bind="$attrs" @click="btnClick"> 申请方案 </span>
  3. </template>
  4. <script>
  5. export default {
  6. name: "applyBtn",
  7. props: {
  8. myType: {
  9. type: String,
  10. default: 'kaoshi'
  11. },
  12. },
  13. methods: {
  14. // 判断是否为移动端
  15. isPC() {
  16. const browserWidth = document.documentElement.clientWidth;
  17. if (browserWidth <= 768) {
  18. return false;
  19. } else {
  20. return true;
  21. }
  22. },
  23. btnClick() {
  24. if (this.isPC()) {
  25. this.$emit('active-pc', this.myType)
  26. } else {
  27. this.$emit('active-h5', this.myType);
  28. }
  29. }
  30. }
  31. }
  32. </script>
  33. <style lang="scss" scoped>
  34. .btn {
  35. width: 154px;
  36. height: 47px;
  37. background: #00b96b;
  38. border-radius: 24px;
  39. padding: 10px 30px;
  40. color: #fff;
  41. cursor: pointer;
  42. }
  43. </style>