zl程序教程

您现在的位置是:首页 >  移动开发

当前栏目

uni-app api:拨打电话(hbuilderx 3.6.18)

AppAPI 18 uni 3.6 电话 HBuilderX 拨打
2023-09-14 09:01:15 时间

一,代码:

<template>
    <view>
        <button @click="call">拨打电话</button>
    </view>
</template>
<script>
    export default {
        data() {
            return {
                
            }
        },
        methods: {
            call(){
                uni.makePhoneCall({
                    phoneNumber:"10086",
                    success(ress) {
                                        console.log("拨打电话成功",ress)
                                },
                    fail(err) {
                                        console.log("拨打电话失败",'err')
                                }
                })
            }
        }
    }
</script>

<style>
</style>

说明:刘宏缔的架构森林是一个专注架构的博客,地址:https://www.cnblogs.com/architectforest

         对应的源码可以访问这里获取: https://github.com/liuhongdi/
         或: https://gitee.com/liuhongdi

说明:作者:刘宏缔 邮箱: 371125307@qq.com

二,测试效果

说明:需要允许拨打电话的权限

 

 

三,查看hbuilderx的版本: