mirror of
https://gitee.com/baidu/amis.git
synced 2024-11-29 18:48:45 +08:00
docs: 修复 custom 文档不正确问题
This commit is contained in:
parent
0ab3e3aed4
commit
01e1c1b2d6
@ -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,
|
||||
{
|
||||
|
@ -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);"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user