首页 ν 小程序 ν 百度小程序悬浮电话按钮的使用 浏览量 收藏文章 海报

百度小程序悬浮电话按钮的使用

swan部分(放在每个swan页面最后):

<view class="tel__wrap">
    <button class="button10" bindtap="calling"><image class="tel_image" src="https://www.zcabc.com/d/file/p/84d4231c9eba7c5975231200605586c1.png"></image></button>
</view>


css部分(只需放在index.css最后的空白位置即可):

.tel__wrap {
 position:fixed;right:26rpx;bottom:30rpx;z-index:3;
}
.tel__wrap .tel_image {
 width:80rpx;height:80rpx;visibility:visible;opacity:0.6;
}
.tel__wrap .button10 {
 visibility:hidden;margin:0;
}


js部分(放在每个js页面):

  ,calling: function (e) {
    
    swan.makePhoneCall({
      phoneNumber: ‘13032616880’,
      success: function () {
        console.log("拨打电话成功!")
      },
      fail: function () {
        console.log("拨打电话失败!")
      }
    })
    
  }

打赏 赞( )
微信
支付宝
微信二维码图片

微信扫描二维码打赏

支付宝二维码图片

支付宝扫描二维码打赏

发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表

技术栈-技术优质的资源信息

加入技术栈 联系我们