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.
|
|
<template> <view class="box"> <view class="phoneIcon" @click.stop="phoneClick"> <slot></slot> </view> <u-action-sheet :actions="servicePhone" :show="show" @select="callPhoneClick" :closeOnClickOverlay="true" @close="show=false" cancelText="取消"></u-action-sheet> </view> </template>
<script> export default { props: ['servicePhone'], data() { return { show: false } }, methods: { phoneClick() { console.log(this.servicePhone) if(!this.servicePhone) return false if(this.servicePhone.length==1) { this.callPhoneClick(this.servicePhone[0]) }else { show=true } }, async callPhoneClick(item) { let phone = item.name // #ifdef APP-PLUS
/* #ifdef APP-PLUS */ let result = await this.$store.dispatch("requestPermissions",'CALL_PHONE',) if (result !== 1) return /* #endif */ this.$u.utils.callPhone(phone) // #endif
// #ifdef H5
var a = document.createElement('a') a.setAttribute('href', 'tel:'+ phone) document.body.appendChild(a) a.click() console.log(phone) // #endif
this.show =false }, } } </script>
<style> </style>
|