跳到主要内容

show-dialog

<basic.show-dialog>provider

显示对话框。

Examples

Confirm

Playground

Alert

Playground

Delete

Playground

Usage in pro-code

import { unwrapProvider } from "@next-core/utils/general";
import type { showDialog as _showDialog } from "@next-bricks/basic/data-providers/show-dialog/show-dialog";

// Use `unwrapProvider` to get the original function of a provider
const showDialog = unwrapProvider<typeof _showDialog>("basic.show-dialog");

function MyComponent() {
const handleClick = useCallback(() => {
showDialog({
type: "confirm",
content: "Are you sure?",
});
}, []);
return <button onClick={handleClick} />;
}

Definition

Parameters

#NameDescriptionType
1options

选项

DialogOptions

Returns

Promise<void>

Type references

DialogOptions

NameTypeRequiredDescription
type"success" | "error" | "warn" | "info" | "confirm" | "delete"

对话框类型

titlestring
contentstring
expectstring
contentStyleReact.CSSProperties