mirror of
https://gitee.com/vant-contrib/vant-weapp.git
synced 2025-04-06 03:58:05 +08:00
41 lines
1.0 KiB
Plaintext
41 lines
1.0 KiB
Plaintext
<radio-group
|
|
class="zan-select__list"
|
|
bindchange="_handleZanSelectChange"
|
|
>
|
|
<label wx:for="{{ items }}" wx:key="value">
|
|
<zan-cell>
|
|
<radio class="zan-select__radio" value="{{ item.value }}" checked="{{ item.value === checkedValue }}"/>
|
|
<span style="{{ parse.getItemStyle(item, checkedValue, activeColor) }}">{{ item.name }}</span>
|
|
<zan-icon
|
|
wx:if="{{ item.value === checkedValue }}"
|
|
slot="footer"
|
|
type="success_no_circle"
|
|
style="color: {{ parse.getColor(activeColor) }};font-size: 14px;"
|
|
/>
|
|
</zan-cell>
|
|
</label>
|
|
</radio-group>
|
|
|
|
|
|
<wxs module="parse">
|
|
function getColor(color) {
|
|
color = color || '#ff4444'
|
|
return color;
|
|
}
|
|
|
|
module.exports = {
|
|
getColor: getColor,
|
|
getItemStyle: function(item, checkedValue, activeColor) {
|
|
var padding = item.padding * 10;
|
|
var style = 'padding-left: ' + padding + 'px;';
|
|
|
|
// 如果为选中状态,则高亮
|
|
if (item.value === checkedValue) {
|
|
style += 'color: ' + getColor(activeColor);
|
|
}
|
|
|
|
return style;
|
|
}
|
|
};
|
|
</wxs>
|