SusRadio

单个单选选项 —— 与父级 SusRadioGroup 搭配实现互斥选择。
包
SusKit · 原子(商业)
属性
| 名称 | 类型 | 默认值 | |
|---|---|---|---|
Model | Prop<bool> | false | v-model |
Value | Prop<string> | "" | v-model |
Label | Prop<string> | "" | v-model |
Color | Prop<string> | "primary" | v-model |
Disabled | Prop<bool> | false | v-model |
Readonly | Prop<bool> | false | v-model |
Density | Prop<string> | "default" | v-model |
Error | Prop<string> | "" | v-model |
HideDetails | Prop<string> | "auto" | v-model |
插槽
没有插槽。
事件
| 名称 | 字段 | 载荷 |
|---|---|---|
Change | OnChange | bool |
样式钩子
USS 类契约 — 无需改 C# 即可覆盖外观。状态通过这些类切换:
keyboard-focussus-radiosus-radio__detailssus-radio__dotsus-radio__inputsus-radio__labelsus-radio--checkedsus-radio--dangersus-radio--density-comfortablesus-radio--density-compactsus-radio--density-defaultsus-radio--disabledsus-radio--errorsus-radio--primarysus-radio--readonlysus-radio--secondarysus-radio--successsus-radio--warning
用法
xml
<template>
<sus:SusRadio Label="Hard"
Value="hard"
Color="primary"
@change="OnPicked" />
</template>
<script>
void OnPicked(bool selected) { /* … */ }
</script>csharp
var radio = new SusRadio();
radio.Label.Value = "Normal";
radio.Value.Value = "normal";
radio.Color.Value = "primary";
radio.OnChange += selected => { /* … */ };备注
- 将 radio 放在
SusRadioGroup(molecule)下;该 atom 会自我注册,并根据分组的选择同步Model。 - 独立使用时:不在分组内时需自行驱动
Model/SyncChecked。 Error+HideDetails遵循与 checkbox / text inputs 相同的表单字段模式。