学员端小程序
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.

44 lines
855 B

  1. <template>
  2. <view class="box">
  3. <view class="phoneIcon" @click.stop="show=true">
  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. data() {
  12. return {
  13. servicePhone: [
  14. {name: '18267103167'},
  15. {name: '18267103168'},
  16. ],
  17. show: false
  18. }
  19. },
  20. methods: {
  21. callPhoneClick(item) {
  22. let phone = item.name
  23. // #ifdef MP-WEIXIN
  24. this.$u.utils.callPhone(phone)
  25. // #endif
  26. // #ifdef H5
  27. var a = document.createElement('a')
  28. a.setAttribute('href', 'tel:'+ phone)
  29. document.body.appendChild(a)
  30. a.click()
  31. console.log(phone)
  32. // #endif
  33. this.show =false
  34. },
  35. }
  36. }
  37. </script>
  38. <style>
  39. </style>