show-dialog
<basic.show-dialog>
provider显示对话框。
Examples
Confirm
Alert
Delete
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
# | Name | Description | Type |
---|---|---|---|
1 | options | 选项 | DialogOptions |
Returns
Promise<void>
Type references
DialogOptions
Name | Description | Type | Default | Required |
---|---|---|---|---|
type | 对话框类型 | "success" | "error" | "warn" | "info" | "confirm" | "delete" | ||
title | string | |||
content | string | ✅ | ||
expect | string | |||
danger | boolean | |||
contentStyle | React.CSSProperties |