美文网首页
小程序如何含有子控件的button的边框

小程序如何含有子控件的button的边框

作者: helang1991 | 来源:发表于2020-12-27 16:01 被阅读0次

微信小程序如何去掉含有子控件的button边框,小程序这边的样式会给你button添加一个默认的边框,具体可以去看样式源码

网上大部分的方法都是通过伪元素来做的

.button::after {
    border: none;
}
image.gif

但是这个方法对于简单的button是有效的,当button中包含子控件的时候,也是就将 plain=true的时候

<button class="button" open-type="contact" plain="true">
   <image src="/static/xxx.png" mode="widthFix"></image>
   <text>客服</text>
</button>
image.gif

还需要这样设置一下,让button在plain="true"的清空下,也得没有边框

.button[plain] {
  border:none;
}
image.gif

相关文章

网友评论

      本文标题:小程序如何含有子控件的button的边框

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