SusRepeatButton

按住即可自动重复点击 —— 先延迟,再按间隔触发。
包
SusKit · 原子(商业)
SusKit · Atoms
属性
| 名称 | 类型 | 默认值 | |
|---|---|---|---|
Text | Prop<string> | "Hold" | v-model |
Icon | Prop<string> | "" | v-model |
Variant | Prop<string> | "elevated" | v-model |
Color | Prop<string> | "primary" | v-model |
Size | Prop<string> | "default" | v-model |
Disabled | Prop<bool> | false | v-model |
InitialDelayMs | Prop<int> | 400 | v-model |
IntervalMs | Prop<int> | 80 | v-model |
IsHolding | Prop<bool> | false | v-model |
插槽
没有插槽。
事件
| 名称 | 字段 | 载荷 |
|---|---|---|
Click | OnClick | — |
Repeat | OnRepeat | — |
样式钩子
USS 类契约 — 无需改 C# 即可覆盖外观。状态通过这些类切换:
sus-repeat-buttonsus-repeat-button--disabledsus-repeat-button--holding
用法
xml
<template>
<sus:SusRepeatButton Text="+"
Variant="tonal"
Color="primary"
InitialDelayMs="400"
IntervalMs="80"
@click="OnStep"
@repeat="OnStep" />
</template>
<script>
void OnStep() { /* increment once per click / tick */ }
</script>csharp
var rpt = new SusRepeatButton();
rpt.Text.Value = "−";
rpt.InitialDelayMs.Value = 400;
rpt.IntervalMs.Value = 80;
rpt.OnClick += () => { /* … */ };
rpt.OnRepeat += () => { /* … */ };变体
elevated · flat · tonal · outlined · text · plain
备注
OnClick在按下时触发;OnRepeat在按住期间每次自动触发时都会触发。