SusPromptDialog

Text prompt card for modal dialogs — single text field with Confirm/Cancel actions; awaitable ShowAsync resolves to the entered string (or null on cancel).
包
SusKit · Molecules(商业)
属性
| 名称 | 类型 | 默认值 | |
|---|---|---|---|
Title | Prop<string> | "Prompt" | |
Placeholder | Prop<string> | "" | v-model |
ConfirmLabel | Prop<string> | "OK" | |
CancelLabel | Prop<string> | "Cancel" | |
Value | Prop<string> | "" | v-model |
插槽
没有插槽。
事件
| 名称 | 字段 | 载荷 |
|---|---|---|
Confirm | OnConfirm | string |
Cancel | OnCancel | — |
样式钩子
USS 类契约 — 无需改 C# 即可覆盖外观。状态通过这些类切换:
sus-prompt-dialogsus-prompt-dialog__footer
用法
xml
<template>
<sus:SusPromptDialog Title="Rename loadout"
Placeholder="Loadout name"
:Value="Name.Value"
@confirm="OnConfirm"
@cancel="OnCancel" />
</template>
<script>
public Prop<string> Name = new("");
void OnConfirm(string value) { /* value == current textfield content */ }
void OnCancel() { }
</script>csharp
// Awaitable helper — hosts the card inside a SusModal and resolves when it closes.
string name = await SusPromptDialog.ShowAsync(
title: "Rename loadout", placeholder: "Loadout name", initialValue: "Scout");
if (name != null) { /* confirmed, name is the entered text */ }说明
Value为内部SusTextfield(outlined / comfortable)提供初值,并在对话框挂载期间保持双向镜像 — 在OnConfirm之后回读,或直接使用触发时传入的值。OnConfirm(string)在确认按钮上以当前 textfield 值触发;OnCancel()在取消按钮上触发。- 静态
ShowAsync辅助通过SusModalService将卡片包进SusModal宿主;若通过模态 scrim 关闭,则解析为null。