freeTrialBtn.vue 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. <template>
  2. <span v-bind="$attrs" @click="btnClick"> 免费试用 </span>
  3. </template>
  4. <script>
  5. export default {
  6. name: "freeTrialBtn",
  7. props: {
  8. myType: {
  9. type: String,
  10. default: 'kaoshi'
  11. }
  12. },
  13. methods: {
  14. isPC() {
  15. const browserWidth = document.documentElement.clientWidth;
  16. if (browserWidth <= 768) {
  17. return false;
  18. } else {
  19. return true;
  20. }
  21. },
  22. btnClick() {
  23. // 执行业务
  24. this.FreeTrial();
  25. // 执行通知
  26. if (this.isPC()) {
  27. this.$emit('active-pc', this.myType)
  28. } else {
  29. this.$emit('active-h5', this.myType)
  30. }
  31. },
  32. FreeTrial() {
  33. if (!this.isPC()) {
  34. // H5
  35. if (this.myType === 'kaoshi') {
  36. window.open('https://cdnks.mtavip.com/mdist/#/webRegister?flug=1')
  37. } else {
  38. window.open('https://cdnks.mtavip.com/mdist/#/webRegister?flug=2')
  39. }
  40. } else {
  41. if (this.myType === 'kaoshi') {
  42. window.open('https://cdnks.mtavip.com/a/register?flug=1')
  43. } else {
  44. window.open('https://cdnks.mtavip.com/a/register?flug=2')
  45. }
  46. }
  47. },
  48. }
  49. }
  50. </script>
  51. <style scoped>
  52. </style>