From b8711bd458ef510d4d90db2c93fa801bc3e8190e Mon Sep 17 00:00:00 2001 From: chiyi Date: Sat, 19 Sep 2026 12:28:57 +0800 Subject: [PATCH] =?UTF-8?q?ux(docs):=20=E5=8F=AF=E7=A9=BA=E5=AD=97?= =?UTF-8?q?=E6=AE=B5=E5=8E=BB=E6=8E=89=E5=8B=BE=E9=80=89=E6=A1=86=E2=80=94?= =?UTF-8?q?=E2=80=94=E7=95=99=E7=A9=BA=E5=8D=B3=E4=B8=8D=E5=8F=91=E9=80=81?= =?UTF-8?q?,=E5=A1=AB=E5=86=99=E5=8D=B3=E5=8F=91=E9=80=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- cmd/fun/docsui/index.html | 20 ++------------------ 1 file changed, 2 insertions(+), 18 deletions(-) diff --git a/cmd/fun/docsui/index.html b/cmd/fun/docsui/index.html index 4cc12be..55f9fe5 100644 --- a/cmd/fun/docsui/index.html +++ b/cmd/fun/docsui/index.html @@ -165,7 +165,7 @@ function showMethod(svc,m){ ${m.dto?`

请求参数${esc(m.dto.name)}

${paramsTable(m.dto,[])} -
带 * 为必填;指针/切片字段可留空省略;切片按 JSON 数组填写。字段名以小写开头随请求传输。
+
带 * 为必填;可空字段留空即不发送;切片按 JSON 数组填写。字段名以小写开头随请求传输。
`:''}

State随请求携带 · Guard 可读 · 存于 localStorage

@@ -238,9 +238,7 @@ function hintFor(t){ } } function controlHTML(t,id){ - if(t.optional){ - return `
${innerControl(t,id)}
`; - } + // 可空字段与必填字段同样直接输入;留空即不随请求发送 return innerControl(t,id); } function innerControl(t,id){ @@ -259,14 +257,6 @@ function innerControl(t,id){ } const firstLower=s=>s?s[0].toLowerCase()+s.slice(1):s; -// 指针字段勾选联动 -document.addEventListener('change',e=>{ - if(e.target.classList&&e.target.classList.contains('prov')){ - const wrap=document.querySelector(`[data-prov="${e.target.dataset.for}"]`); - if(wrap){const el=wrap.querySelector('input,textarea,select');if(el)el.disabled=!e.target.checked} - } -}); - /* ---------- 取值 ---------- */ function collectStruct(t,path,obj,errors){ t.fields.forEach(f=>{ @@ -274,12 +264,6 @@ function collectStruct(t,path,obj,errors){ const id='f-'+p.join('.'); const key=firstLower(f.name); let el=document.getElementById(id); - let provided=true; - if(f.type.optional){ - const cb=document.querySelector(`.prov[data-for="${id}"]`); - provided=cb&&cb.checked; - } - if(!provided)return; if(!el)return; const v=el.value!=null?el.value.trim():''; const kind=f.type.kind;