picgo/view/picture.html

33 lines
1004 B
HTML
Raw Normal View History

{{define "style"}}
{{end}}
{{define "content"}}
<h2>通用弹出表单示例</h2>
<!-- 触发按钮 -->
<button id="openFormButton" class="btn btn-primary">打开表单</button>
{{end}}
{{define "script"}}
2024-08-06 20:37:34 +08:00
<script src="/static/js/lib/modal.js"></script>
<script>
$(document).ready(function() {
// 示例字段配置
let fields = [
2024-08-06 20:37:34 +08:00
{ label: '用户名:', name: 'username', type: 'text' },
{ label: '密码:', name: 'password', type: 'password' },
{ label: '确认密码:', name: 'password', type: 'password' }
]
// 初始化表单并显示
$('#openFormButton').on('click', function() {
let title = '用户注册'
let modal = new Modal(title, fields,function(data) {
console.log('表单提交数据:', data)
// 在此处处理表单提交,例如通过 AJAX 发送到服务器
})
2024-08-06 20:37:34 +08:00
modal.RenderModalForm()
})
})
</script>
{{end}}