我只需要使用html和CSS创建一个自定义复选框.到目前为止,我有:
HTML/CSS:
.checkbox-custom {
opacity: 0;
position: absolute;
}
.checkbox-custom,
.checkbox-custom-label {
display: inline-block;
vertical-align: middle;
margin: 5px;
cursor: pointer;
}
.checkbox-custom + .checkbox-custom-label:before {
content: '';
background: #fff;
border-radius: 5px;
border: 2px solid #ddd;
display: inline-block;
vertical-align: middle;
width: 10px;
height: 10px;
padding: 2px;
margin-right: 10px;
text-align: center;
}
.checkbox-custom:checked + .checkbox-custom-label:before {
content: "";
display: inline-block;
width: 1px;
height: 5px;
border: solid blue;
border-width: 0 3px 3px 0;
transform: rotate(45deg);
-webkit-transform: rotate(45deg);
-ms-transform: rotate(45deg);
border-radius: 0px;
margin: 0px …Run Code Online (Sandbox Code Playgroud)我找不到类似的问题,但我确定它出现在某个地方,所以请指出方向,如果是的话.我正在编写一个rspec测试,并希望动态分配9个变量.
很长的路要走:
@store.owner.item1 = (Faker::Lorem.word)
@store.owner.item2 = (Faker::Lorem.word)
@store.owner.item3 = (Faker::Lorem.word)
@store.owner.item4 = (Faker::Lorem.word)
@store.owner.item5 = (Faker::Lorem.word)
@store.owner.item6 = (Faker::Lorem.word)
@store.owner.item7 = (Faker::Lorem.word)
@store.owner.item8 = (Faker::Lorem.word)
@store.owner.item9 = (Faker::Lorem.word)
Run Code Online (Sandbox Code Playgroud)
接近我正在寻找的东西(不起作用):
(1..9).each { |number| @store.owner.send("item#{number}") = (Faker::Lorem.word) }
Run Code Online (Sandbox Code Playgroud) 我有一个包含嵌套对象的对象.我想过滤它们并返回密钥(如果存在).
例如:
var meals = {
food_meals: [
{meal_id: 15749, address_required: false, button_text: "choose", can_choose_meal: true},
{meal_id: 15750, address_required: false, button_text: "choose", can_choose_meal: true}
],
wine_meals: [
{meal_id: 11651, address_required: false, button_text: "choose", can_choose_meal: true},
{meal_id: 4424, address_required: false, button_text: "choose", can_choose_meal: true}
],
kids_meals: [
{meal_id: 15763, address_required: false, button_text: "choose", can_choose_meal: true},
{meal_id: 15764, address_required: false, button_text: "choose", can_choose_meal: true},
{meal_id: 15765, address_required: false, button_text: "choose", can_choose_meal: true}
]
}
Run Code Online (Sandbox Code Playgroud)
如果我用meal_id15764 吃饭,那么我会希望返回该值的关键字(在这种情况下kids_meals)
我可以通过这样做从嵌套对象中过滤掉这顿饭
meals.kids_meals.filter(meal …Run Code Online (Sandbox Code Playgroud) checkbox ×1
css ×1
dynamic ×1
ecmascript-6 ×1
html ×1
input ×1
javascript ×1
reactjs ×1
rspec ×1
ruby ×1