* zin: support for setting ajax option in form widgets.

This commit is contained in:
sunhao
2023-06-13 16:50:03 +08:00
parent da14787a22
commit a7b0d4e788
+5 -5
View File
@@ -28,10 +28,7 @@ class formBase extends wg
'cancelBtnText?: string', // 表单取消按钮文本,如果不指定则使用 `$lang->goback` 的值。
'back?: string="APP"', // 表单返回行为
'backUrl?: string', // 表单返回链接
);
protected static $defaultProps = array(
'actions' => array('submit', 'cancel')
'ajax?:array' // Ajax 表单选项
);
protected function buildActions(): wg|null
@@ -84,7 +81,10 @@ class formBase extends wg
protected function buildAfter(): array
{
$after = parent::buildAfter();
if($this->prop('target') === 'ajax') $after[] = zui::ajaxForm(set::_to('#' . $this->id()));
if($this->prop('target') === 'ajax')
{
$after[] = zui::ajaxForm(set::_to('#' . $this->id()), set($this->prop('ajax')));
}
return $after;
}