Recently, I was working on the uniapp project. When I used the checkbox tag, I found that the label effect was invalid, but the effect of the official website was good. The failure diagram is shown below. After comparing the console styles, I found that the invalid code did not write the style. When using
uniapp to create the project , the item with the checkbox style is not created, so even with the label, it doesn't have the desired effect.
mouse click change
Unchecked
Checked
Solution:
Add the following code in App.vue:
uni-checkbox .uni-checkbox-input {
border-radius: 3upx !important;
color: #ffffff !important;
}
uni-checkbox .uni-checkbox-input.uni-checkbox-input-checked {
color: #fff;
border-color: rgb(0, 122, 255);
background: rgb(0, 122, 255);
}
uni-checkbox .uni-checkbox-input.uni-checkbox-input-checked:after {
font-size: 18px;
}
achieve effect