- 推荐学习文档
template 部分
<template><view><text @tap="handlePhoneClick('1234567890')">1234567890</text></view>
</template>
script 部分
export default {methods: {handlePhoneClick(phoneNumber) {uni.showActionSheet({itemList: ['复制', '拨打'],success: (res) => {if (res.tapIndex === 0) {// 复制操作uni.setClipboardData({data: phoneNumber,success: () => {uni.showToast({title: '复制成功',icon: 'success'});},fail: () => {uni.showToast({title: '复制失败',icon: 'none'});}});} else if (res.tapIndex === 1) {// 拨打操作uni.makePhoneCall({phoneNumber: phoneNumber});}}});}}
};
在上述代码中,当点击包含电话的