{ "slug": "alertmodal", "mode": "single", "examples": [ { "id": "alertmodal-ex-1", "title": "查看提示", "titleSrc": "demo", "desc": "", "html": "\n\n\n\n
\n
\n
\n i\n
系统升级通知
\n
\n
本周六 02:00-04:00 将进行系统维护,期间服务不可用,请提前安排。
\n
\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
\n
\n
\n i\n
系统升级通知
\n
\n
本周六 02:00-04:00 将进行系统维护,期间服务不可用,请提前安排。
\n
\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 \n \n );\n}", "vue3": "\n\n", "vue2": "\n\n", "tsx": "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(): JSX.Element {\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): JSX.Element {\n setType(nextType);\n setVisible(true);\n }\n function close(): JSX.Element {\n setVisible(false);\n }\n\n return (\n <>\n {CASES.map(function (c) {\n return (\n \n );\n })}\n \n \n );\n}", "vue3ts": "\n\n", "vue2ts": "\n\n" }, "notes": [ "依据 frameworks/AlertModal.html 脚本 showAlert(type) 与 ICONS/TITLES 映射,以及四个触发按钮(查看提示/成功提示/操作失败/警告提示)各自的 data-type;prop visible/type/title/content/okText/onOk 见 AlertModal.jsx,正文文案取自演示页 .kole-alert-content。" ] } ], "curated": true }