如何添加一鍵撥號(hào)懸浮按鈕?

1854次閱讀

swan部分(放在每個(gè)swan頁(yè)面最后),圖片最好自己下載上傳到自己的站點(diǎn),再修改下面的圖片地址:

<view class="tel__wrap">

? ? <button class="button10" bindtap="calling_tel">

<image class="tel_image" src="https://static.51jiancong.com/wxapp/936/images/20190612/20190612085712_16199.png"></image>

</button>

</view>



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

.tel__wrap {

?position:fixed;right:26rpx;bottom:30rpx;z-index:999;

}

.tel__wrap .tel_image {

?width:80rpx;height:80rpx;visibility:visible;opacity:0.6;

}

.tel__wrap .button10 {

?visibility:hidden;margin:0;

}


js部分(放在每個(gè)js頁(yè)面最后的? ?});? 前面):

?,calling_tel: function (e) {

? ? let mobile = e.currentTarget.dataset.id;

? ? if (!mobile) {

? ? ? mobile = app.globaldata.settings.cfg_kefu_tel;

? ? }

? ? swan.makePhoneCall({

? ? ? phoneNumber: mobile,

? ? ? success: function () {

? ? ? ? console.log("撥打電話成功!")

? ? ? },

? ? ? fail: function () {

? ? ? ? console.log("撥打電話失??!")

? ? ? }

? ? })

? }

本文由夫唯團(tuán)隊(duì)編輯,如發(fā)現(xiàn)錯(cuò)誤,歡迎通過(guò)客服微信反饋。

夫唯于2024年12月停止百度SEO研究和培訓(xùn)。道別信: 夫唯:再見(jiàn)了百度SEO!

2025年1月正式啟動(dòng)Google SEO培訓(xùn)課程,一千零一夜帶領(lǐng)大家一起出海。

感興趣的同學(xué),請(qǐng)?zhí)砑诱猩头∧⑿牛簊eowhy2021。 微信掃碼添加客服人員

我們的目標(biāo):讓大家獨(dú)立站出海不再“望洋興嘆”。

Processed in 0.815605 Second , 485 querys.