1. 程式人生 > >微信小程式改變單選多選按鈕樣式

微信小程式改變單選多選按鈕樣式

/*  重寫 checkbox 樣式  */

/* 未選中的 背景樣式 */

checkbox .wx-checkbox-input {
  border-radius: 50%; /* 圓角 */
  width: 40rpx; /* 背景的寬 */
  height: 40rpx; /* 背景的高 */
}

/* 選中後的 背景樣式 (紅色背景 無邊框 可根據UI需求自己修改) */

checkbox .wx-checkbox-input.wx-checkbox-input-checked {
 border-color: #333; 
  background: #333;
}

/* 選中後的 對勾樣式 (白色對勾 可根據UI需求自己修改) */
checkbox .wx-checkbox-input.wx-checkbox-input-checked::before { border-radius: 50%; /* 圓角 */ width: 40rpx; /* 選中後對勾大小,不要超過背景的尺寸 */ height: 40rpx; /* 選中後對勾大小,不要超過背景的尺寸 */ display: inline-flex; align-items: center; justify-content: center; font-size: 24rpx; /* 對勾大小 30rpx */ color: #fff; /* 對勾顏色 白色 */
background: transparent; transform: translate(-50%, -50%) scale(1); -webkit-transform: translate(-50%, -50%) scale(1); }
/* 重寫 radio 樣式 */ /* 未選中的 背景樣式 */ radio .wx-radio-input{ border-radius: 50%;/* 圓角 */ width: 40rpx; height: 40rpx; } /* 選中後的 背景樣式 (紅色背景 無邊框 可根據UI需求自己修改) */ radio .wx-radio-input
.wx-radio-input-checked{ border-color: #333; background: #333; } /* 選中後的 對勾樣式 (白色對勾 可根據UI需求自己修改) */ radio .wx-radio-input.wx-radio-input-checked::before{ border-radius: 50%;/* 圓角 */ width: 40rpx; /* 選中後對勾大小,不要超過背景的尺寸 */ height: 40rpx; /* 選中後對勾大小,不要超過背景的尺寸 */ display: inline-flex; align-items: center; justify-content: center; font-size: 24rpx; /* 對勾大小 30rpx */ color:#fff; /* 對勾顏色 白色 */ background: transparent; transform:translate(-50%, -50%) scale(1); -webkit-transform:translate(-50%, -50%) scale(1); }