From 01e1c1b2d60cddc9f9584ff83518bb6878b80002 Mon Sep 17 00:00:00 2001 From: wuduoyi Date: Wed, 13 Jul 2022 18:30:28 +0800 Subject: [PATCH] =?UTF-8?q?docs:=20=E4=BF=AE=E5=A4=8D=20custom=20=E6=96=87?= =?UTF-8?q?=E6=A1=A3=E4=B8=8D=E6=AD=A3=E7=A1=AE=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/zh-CN/components/custom.md | 5 +++-- docs/zh-CN/extend/custom-sdk.md | 5 +++-- examples/components/Form/Custom.jsx | 2 +- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/docs/zh-CN/components/custom.md b/docs/zh-CN/components/custom.md index cf48e2375..21208ee62 100644 --- a/docs/zh-CN/components/custom.md +++ b/docs/zh-CN/components/custom.md @@ -41,7 +41,8 @@ order: 26 const button = document.createElement('button'); button.innerText = '点击修改'; button.onclick = event => { - onChange('new'); // 这个 onChange 方法只有放在表单项中才能调用 + // 这个 onChange 方法只有放在表单项中才能调用,第二个参数是表单项名称 + onChange('new', 'myName'); event.preventDefault(); }; dom.appendChild(button); @@ -148,7 +149,7 @@ onMount: (dom, data, onChange, props) => { const button = document.createElement('button'); button.innerText = '点击修改姓名'; button.onclick = event => { - onChange('new name'); + onChange('new name', 'name'); props.onAction( event, { diff --git a/docs/zh-CN/extend/custom-sdk.md b/docs/zh-CN/extend/custom-sdk.md index 899984a0b..e5bbb4cfc 100644 --- a/docs/zh-CN/extend/custom-sdk.md +++ b/docs/zh-CN/extend/custom-sdk.md @@ -19,7 +19,8 @@ title: 自定义组件 - SDK const button = document.createElement('button'); button.innerText = '点击修改姓名'; button.onclick = event => { - onChange('new name'); + // 第二个参数是要修改的表单项名称 + onChange('new name', 'username'); event.preventDefault(); }; dom.appendChild(button); @@ -52,7 +53,7 @@ title: 自定义组件 - SDK "name": "username", "type": "custom", "label": "自定义组件", - "onMount": "const button = document.createElement('button'); button.innerText = '点击修改姓名'; button.onclick = event => { onChange('new name'); event.preventDefault(); }; dom.appendChild(button);" + "onMount": "const button = document.createElement('button'); button.innerText = '点击修改姓名'; button.onclick = event => { onChange('new name', 'username'); event.preventDefault(); }; dom.appendChild(button);" } ] } diff --git a/examples/components/Form/Custom.jsx b/examples/components/Form/Custom.jsx index 9b0be6cf0..b3b584659 100644 --- a/examples/components/Form/Custom.jsx +++ b/examples/components/Form/Custom.jsx @@ -74,7 +74,7 @@ export default { const button = document.createElement('button'); button.innerText = '点击修改姓名'; button.onclick = event => { - onChange('new name'); + onChange('new name', 'name'); event.preventDefault(); }; dom.appendChild(button);