{{/* dialog.html — 通用对话框公共组件 对标 React 版 Dialog.tsx,提供确认 / 提示两种对话框。 提供两个子模板: hp-dialog-html → 放在页面 body 末尾(HTML 结构) hp-dialog-js → 紧跟其后(JS API) 快捷模板(推荐,一行搞定): hp-dialog → 同时输出 html + js JS API: hpConfirm({ title: '标题', message: '内容', type: 'danger', // default | danger | warning | success confirmText: '确定', // 可选,默认"确定" cancelText: '取消', // 可选,默认"取消" onConfirm: function(){ ... } // 确认回调 }) hpAlert({ title: '标题', message: '内容', type: 'error', // default | error | warning | success | info buttonText: '知道了', // 可选 onClose: function(){ ... } // 可选 }) hpCloseDialog() // 手动关闭 使用示例(任意页面 前): {{template "hp-dialog"}} 建议:在 base.html 的 hp-footer 中统一引入,所有页面自动可用。 */}} {{/* ── 快捷入口:HTML + JS 一起输出 ─────────────────────────── */}} {{define "hp-dialog"}} {{template "hp-dialog-html"}} {{template "hp-dialog-js"}} {{end}} {{/* ── 对话框 HTML 结构 ──────────────────────────────────────── */}} {{define "hp-dialog-html"}} {{end}} {{/* ── 对话框 JS API ─────────────────────────────────────────── */}} {{define "hp-dialog-js"}} {{end}}