微信小程序如何隐藏客服按钮

发布时间:2022-03-15 09:59:09 作者:iii
来源:亿速云 阅读:447

这篇文章主要讲解了“微信小程序如何隐藏客服按钮”,文中的讲解内容简单清晰,易于学习与理解,下面请大家跟着小编的思路慢慢深入,一起来研究和学习“微信小程序如何隐藏客服按钮”吧!

微信官方给了客服按钮标签
<contact-button type="default-dark" size="100"></contact-button>

这个标签的样式不可修改,如果我们要换自己想改的图片,需要怎么做呢?就像我图片上的样式。
我这个客服控件是放在一个正圆的view里的居中位置,所以,我这里先通过position定位到居中位置,把size放到最大。

然后把透明度设置为0即可,然后给正圆这个view设置一图片背景,图片就是你想要显示的icon

提示卡片

提示卡片是一个view,view里面有一个&times;用来绑定隐藏事件的,bindtap="onChangeShowState"就是用来隐藏这个view的

index.wxml

<!-- 提示卡片 -->
<view class="bright789_view_hide{{showView?'bright789_view_show':''}}">
  <view class="bright789-text">  <view bindtap="onChangeShowState" class="close">&times;</view>  <view class="text">有疑问可以点这里咨询哦</view>
  </view>
</view>
<!-- 悬浮按钮 -->
<view class="zixun"><contact-button type="default-dark" size="100" class="kf"></contact-button></view>

index.wxss

.zixun{
  width: 55px;
  height: 55px;
  background: url(http://wxpad.cn/yunpan/cdn/imgsrc/1530949769.png)no-repeat;
  position: fixed;
  bottom: 35px;
  right: 35px;
  border-radius: 50%;
  box-shadow: 0 0 5px #ddd;
  text-align: center;
  font-size: 14px;
  color: #333;
}

.zixun .kf{
  position: relative;
  top: 0px;
  left: 0px;
  margin:15px auto;
  opacity: 0;
}

.bright789-text{
  position: fixed;
  bottom: 100px;
  right: 65px;
  width: 200px;
  height: 45px;
  background-image: linear-gradient(to left, #4481eb 0%, #04befe 100%);
  border-bottom-left-radius: 50px;
  border-top-left-radius: 50px;
  border-top-right-radius: 50px;
  z-index: 99999999;
  box-shadow: 0 0 10px #eee;
  line-height: 40px;
  text-indent: 15px;
}

.bright789-text .close{
  font-size: 1.5em;
  color: #fff;
}


.bright789-text .text{
  font-size: 13px;
  color: #fff;
  margin-top: -38px;
  margin-left: 20px;
}

.bright789_view_hide{
    display: none;
}

index.js

//index.js
//获取应用实例
const app = getApp()
Page({
  data: {
    showView: true
  },

onLoad: function (options) {
  // 生命周期函数--监听页面加载
  showView: (options.showView == "true" ? true : false)
},
onChangeShowState: function () {
  var that = this;
  that.setData({
    showView: (!that.data.showView)
  })
 }
})

感谢各位的阅读,以上就是“微信小程序如何隐藏客服按钮”的内容了,经过本文的学习后,相信大家对微信小程序如何隐藏客服按钮这一问题有了更深刻的体会,具体使用情况还需要大家实践验证。这里是亿速云,小编将为大家推送更多相关知识点的文章,欢迎关注!

推荐阅读:
  1. 微信小程序在线客服系统都有哪些功能?
  2. 微信小程序如何实现在线客服功能

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

微信小程序

上一篇:linux如何批量解压当前目录下以.zip结尾的所有文件到指定目录

下一篇:微信小程序带来的好处有哪些

相关阅读

您好,登录后才能下订单哦!

密码登录
登录注册
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》