applyBtn.vue 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. <template>
  2. <span class="appley-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">
  34. .appley-btn{
  35. width: 154px;
  36. height: 48px;
  37. line-height: 48px;
  38. background: #00b96b;
  39. border-radius: 24px;
  40. color: #fff;
  41. cursor: pointer;
  42. display: inline-block;
  43. text-align: center;
  44. @media (max-width: 768px) {
  45. width: 44%;height:35px;line-height:35px;max-width: 120px;margin: 0 3%;display: inline-block;
  46. padding: 0;text-align: center;font-size: 14px;
  47. }
  48. }
  49. .appley-btn.shouye {
  50. height: 55px;
  51. width: 180px;
  52. line-height: 55px;
  53. color: #00b96b;
  54. background: #fff;
  55. }
  56. </style>