洛阳学员端
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.

50 lines
1016 B

10 months ago
8 months ago
10 months ago
8 months ago
10 months ago
  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: ['servicePhone'],
  12. data() {
  13. return {
  14. show: false
  15. }
  16. },
  17. methods: {
  18. phoneClick() {
  19. console.log(this.servicePhone)
  20. if(!this.servicePhone) return false
  21. if(this.servicePhone.length==1) {
  22. this.callPhoneClick(this.servicePhone[0])
  23. }else {
  24. show=true
  25. }
  26. },
  27. callPhoneClick(item) {
  28. let phone = item.name
  29. // #ifdef APP-PLUS
  30. this.$u.utils.callPhone(phone)
  31. // #endif
  32. // #ifdef H5
  33. var a = document.createElement('a')
  34. a.setAttribute('href', 'tel:'+ phone)
  35. document.body.appendChild(a)
  36. a.click()
  37. console.log(phone)
  38. // #endif
  39. this.show =false
  40. },
  41. }
  42. }
  43. </script>
  44. <style>
  45. </style>