{ "slug": "alertmodal", "mode": "single", "examples": [ { "id": "alertmodal-ex-1", "title": "查看提示", "titleSrc": "demo", "desc": "", "html": "\n\n\n\n
", "preview": { "show": [ [ 0 ], [ 1 ], [ 2 ], [ 3 ], [ 4 ] ], "hide": [], "mode": "single" }, "previewSafe": true, "previewUnsafeReasons": [], "source": "curated", "code": { "html": "\n\n\n\n", "jsx": "import { useState } from 'react';\nimport { KoleAlertModal } from 'kole-ui/react';\n\nconst CASES = [\n { type: 'info', label: '查看提示', title: '系统升级通知' },\n { type: 'success', label: '成功提示', title: '操作成功' },\n { type: 'error', label: '操作失败', title: '操作失败' },\n { type: 'warning', label: '警告提示', title: '警告提示' },\n];\n\nexport default function AlertModalDemo() {\n const [visible, setVisible] = useState(false);\n const [type, setType] = useState('info');\n const current = CASES.filter(function (c) { return c.type === type; })[0];\n\n function open(nextType) {\n setType(nextType);\n setVisible(true);\n }\n function close() {\n setVisible(false);\n }\n\n return (\n <>\n {CASES.map(function (c) {\n return (\n \n );\n })}\n