0
点赞
收藏
分享

微信扫一扫

【微信小程序】设置button禁用样式

无聊到学习 2024-07-24 阅读 16

写了一个通用按钮样式,打算在特定情况触发其disabled状态,但触发后效果并不是下面.wxss中的期望的样式。。。

.common-btn {
  background-color: #ff8533;
  color: #ffffff;
  text-align: center;
  border-radius: 4px;
}

.common-btn:active {
  opacity: 0.8;
}

.common-btn:disabled {
  pointer-events: none;
  opacity: 0.5;
}

可用如下代码解决

wx-button[disabled]:not([type]) {
	background-color: #ff8533;
  color: #ffffff;
  pointer-events: none;
  opacity: 0.5;
}
举报

相关推荐

0 条评论