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.
51 lines
1016 B
51 lines
1016 B
<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
|
|
}
|
|
},
|
|
callPhoneClick(item) {
|
|
|
|
let phone = item.name
|
|
// #ifdef APP-PLUS
|
|
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>
|