微信小程序 - button边框和背景色修改

微信小程序开发中使用 button 设置禁用时候,按钮会有默认的背景色和边框,下面分享下修改按钮边框和背景色。

wxml代码:

   <view>
      <button class="publish" disabled="{{disabled}}" bindtap='submit'>发表</button>
    </view>

wxss代码:

/* 去掉按钮边框方法一 */
.publish::after {
  border: none;
}

/* 去掉按钮边框方法二 */
.publish::after {
  border: 0;
}

button 设置 disabled 之后背景颜色和字体颜色的值都是默认的 ,需要修改 disabled 背景颜色和字体颜色。

/* 修改默认背景色 */
.publish[disabled][type="default"], wx-button[disabled]:not([type]) {
  color: #7f8389;
  background-color: white;
  border-color: white;
}

水平有限,若有问题请留言交流!

互相学习,共同进步:) 转载请注明出处谢谢!

猜你喜欢

转载自my.oschina.net/hp2017/blog/1825859