FormWizard

表单 / 问卷构建器 · 拖拽构建 · 实时预览 · 导出代码

当前表单 0 个字段
字段工具箱
T 单行文本
多行文本
单选
多选
下拉选择
@ 邮箱
电话
文件上传
从左侧点击或拖拽字段到此处
字段属性
选择字段以编辑属性
(function(){window.addEventListener('error',function(e){if(e.target&&(e.target.tagName==='LINK'||e.target.tagName==='SCRIPT')){return}console.error('FormWizard runtime error:',e.error||e.message);try{if(typeof showToast==='function')showToast('发生错误,请重试')}catch(_){}});window.addEventListener('unhandledrejection',function(e){console.error('FormWizard unhandled promise rejection:',e.reason)});['toast','canvasArea','canvasFields','propContent','toolbox'].forEach(function(id){if(!document.getElementById(id)){console.warn('FormWizard: DOM element #'+id+' not found')}})})(); `; } $('exportHtmlBtn').addEventListener('click', () => { if (state.fields.length === 0) { showToast('请先添加字段'); return; } const html = generateFormHtml(); const blob = new Blob([html], {type:'text/html'}); const a = document.createElement('a'); a.download = 'form.html'; a.href = URL.createObjectURL(blob); a.click(); URL.revokeObjectURL(a.href); showToast('已导出 form.html'); }); $('exportJsonBtn').addEventListener('click', () => { if (state.fields.length === 0) { showToast('请先添加字段'); return; } const json = JSON.stringify(state.fields, null, 2); const blob = new Blob([json], {type:'application/json'}); const a = document.createElement('a'); a.download = 'form-config.json'; a.href = URL.createObjectURL(blob); a.click(); URL.revokeObjectURL(a.href); showToast('已导出 form-config.json'); }); $('exportReactBtn').addEventListener('click', () => { if (state.fields.length === 0) { showToast('请先添加字段'); return; } const fieldsCode = state.fields.map(f => { const req = f.required ? ' required' : ''; switch (f.type) { case 'text': return ` `; case 'email': return ` `; case 'tel': return ` `; case 'textarea': return `