onlineInformationBtn.vue 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. <template>
  2. <a v-if="isPC" class="zxzx-btn" @click="btnClick">在线咨询</a>
  3. </template>
  4. <script>
  5. import {linkForKefu} from "~/defaultConfig"
  6. export default {
  7. name: "onlineInformation",
  8. props: {
  9. myType: {
  10. type: String,
  11. default: '1'
  12. }
  13. },
  14. data() {
  15. return {
  16. linkForKefu
  17. }
  18. },
  19. methods: {
  20. isPC() {
  21. const browserWidth = document.documentElement.clientWidth;
  22. if (browserWidth <= 768) {
  23. return false;
  24. } else {
  25. return true;
  26. }
  27. },
  28. btnClick() {
  29. if (this.isPC()) {
  30. window.open(this.linkForKefu)
  31. } else {
  32. window.location.href = this.linkForKefu
  33. }
  34. }
  35. },
  36. }
  37. </script>
  38. <style lang="scss">
  39. .zxzx-btn {
  40. width: 154px;
  41. height: 48px;
  42. line-height: 48px;
  43. border-radius: 24px;
  44. border: 1px solid #00b96b;
  45. cursor: pointer;
  46. display: inline-block;
  47. text-align: center;
  48. color: #00b96b;
  49. @media (max-width: 768px) {
  50. width: 44%;
  51. height: 35px;
  52. line-height: 35px;
  53. max-width: 120px;
  54. margin: 0 3%;
  55. font-size: 14px;
  56. }
  57. }
  58. .zxzx-btn.shouye {
  59. height: 55px;
  60. width: 180px;
  61. line-height: 55px;
  62. color: #fff;
  63. background: #00b96b;
  64. }
  65. .zxzx-btn.green {
  66. background-color: #00B96B;
  67. color: #fff;
  68. }
  69. </style>