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.
60 lines
1.1 KiB
60 lines
1.1 KiB
<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: {
|
|
// type: Array,
|
|
// default: []
|
|
// }
|
|
// },
|
|
props: ['servicePhone'],
|
|
data() {
|
|
return {
|
|
// servicePhone: [
|
|
// {name: '18267103167'},
|
|
// {name: '18267103168'},
|
|
// ],
|
|
show: false
|
|
}
|
|
},
|
|
methods: {
|
|
phoneClick() {
|
|
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 MP-WEIXIN
|
|
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>
|