SusNumberInput

带 spin 按钮的数字输入框 —— min / max / step / precision。
包
SusKit · 原子(商业)
属性
| 名称 | 类型 | 默认值 | |
|---|---|---|---|
Model | Prop<float> | 0f | v-model |
Min | Prop<float> | 0f | v-model |
Max | Prop<float> | 100f | v-model |
Step | Prop<float> | 1f | v-model |
Precision | Prop<int> | 0 | v-model |
Label | Prop<string> | "" | v-model |
Hint | Prop<string> | "" | v-model |
Error | Prop<string> | "" | v-model |
Variant | Prop<string> | "outlined" | v-model |
Density | Prop<string> | "default" | v-model |
Disabled | Prop<bool> | false | v-model |
Readonly | Prop<bool> | false | v-model |
HideSpinButtons | Prop<bool> | false | v-model |
插槽
没有插槽。
事件
| 名称 | 字段 | 载荷 |
|---|---|---|
Change | OnChange | float |
样式钩子
USS 类契约 — 无需改 C# 即可覆盖外观。状态通过这些类切换:
sus-number-inputsus-number-input__controlsus-number-input__errorsus-number-input__fieldsus-number-input__hintsus-number-input__labelsus-number-input__spinsus-number-input__spin-iconsus-number-input--density-comfortablesus-number-input--density-compactsus-number-input--disabledsus-number-input--errorsus-number-input--filledsus-number-input--focusedsus-number-input--hide-spinsus-number-input--outlinedsus-number-input--readonlyunity-base-text-fieldunity-base-text-field__inputunity-labelunity-text-elementunity-text-field
用法
xml
<template>
<sus:SusNumberInput Label="Party size"
:Model="PartySize.Value"
Min="1"
Max="8"
Step="1"
Variant="outlined"
@change="OnPartySize" />
</template>
<script>
public Prop<float> PartySize = new(4f);
void OnPartySize(float value) { /* … */ }
</script>csharp
var num = new SusNumberInput();
num.Label.Value = "Quantity";
num.Model.Value = 1f;
num.Min.Value = 0f;
num.Max.Value = 99f;
num.Step.Value = 1f;
num.OnChange += value => { /* … */ };备注
HideSpinButtons只保留键盘输入,隐藏 +/- 按钮。Precision控制格式化后字段中显示的小数位数。