美文网首页
小程序button去除边框,自定义样式

小程序button去除边框,自定义样式

作者: angryAnt的简书 | 来源:发表于2018-07-26 01:11 被阅读0次

微信小程序button去除边框

微信小程序的button提供了几种系统样式,但在我们开发中一般都用不上,但是有些功能必须只能用button来调用,如分享(open-type="share")

<image class='share-img' src='/assets/btn_share_group.png'/>    
<button class='share-img-button' open-type="share" hover-class="none"></button>

所以我们需要在view上面盖上一个透明的button,来响应事件。
step1.去除button的边框:

.share-img-button{
  border: none;
}
.share-img-button::after{
  border: none
}

step2.去掉button背景:

.share-img-button{
  background: none;
  border: none;
}

step3.盖在要目标view上面:

.share-img{
  width: 96rpx;
  height: 96rpx;
  margin-bottom: 10rpx;
  background: none;
}
.share-img-button{
  position: absolute;
  top: 0rpx;
  width: 96rpx;
  height: 96rpx;
  background: none;
  border: none;
}

Done!

相关文章

网友评论

      本文标题:小程序button去除边框,自定义样式

      本文链接:https://www.haomeiwen.com/subject/iohvmftx.html