洛阳学员端
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

59 lines
1.1 KiB

  1. <template>
  2. <view class="box">
  3. <view class="phoneIcon" @click.stop="phoneClick">
  4. <slot></slot>
  5. </view>
  6. <u-action-sheet :actions="servicePhone" :show="show" @select="callPhoneClick" :closeOnClickOverlay="true" @close="show=false" cancelText="取消"></u-action-sheet>
  7. </view>
  8. </template>
  9. <script>
  10. export default {
  11. // props: {
  12. // servicePhone: {
  13. // type: Array,
  14. // default: []
  15. // }
  16. // },
  17. props: ['servicePhone'],
  18. data() {
  19. return {
  20. // servicePhone: [
  21. // {name: '18267103167'},
  22. // {name: '18267103168'},
  23. // ],
  24. show: false
  25. }
  26. },
  27. methods: {
  28. phoneClick() {
  29. if(!this.servicePhone) return false
  30. if(this.servicePhone.length==1) {
  31. this.callPhoneClick(this.servicePhone[0])
  32. }else {
  33. show=true
  34. }
  35. },
  36. callPhoneClick(item) {
  37. let phone = item.name
  38. // #ifdef MP-WEIXIN
  39. this.$u.utils.callPhone(phone)
  40. // #endif
  41. // #ifdef H5
  42. var a = document.createElement('a')
  43. a.setAttribute('href', 'tel:'+ phone)
  44. document.body.appendChild(a)
  45. a.click()
  46. console.log(phone)
  47. // #endif
  48. this.show =false
  49. },
  50. }
  51. }
  52. </script>
  53. <style>
  54. </style>