要通过ui_component创建后端表单,我在配置文件中定义以下内容以显示按钮save和saveAndContinue Button
<item name="buttons" xsi:type="array">
    <item name="save" xsi:type="string">namespace\module\Block\Adminhtml\Edit\SaveButton</item>
    <item name="save_and_continue" xsi:type="string">namespace\module\Block\Adminhtml\Edit\SaveAndContinueButton</item>
</item>分别创建了两个文件SaveButton.php和SaveAndContinueButton.php,并且都实现了ButtonProviderInterface
据我所知,按钮主要是从getButtonData函数渲染的。看到SaveAndContinueButton.php
public function getButtonData()
{
    $TodoItemId = $this->getTodoItemId();
    $data = [];
    if ($TodoItemId) {
        $data = [
            'label' => __('Save and Continue Edit'),
            'class' => 'save',
            'data_attribute' => [
                'mage-init' => [
                    'button' => ['event' => 'saveAndContinueEdit'],
                ],
            ],
            'sort_order' => 80,
        ];
    }
    return $data;
}这data_attribute是我不了解的地方。它如何知道要处理保存请求的文件?
如果我们检查SaveButton.php,我们看到
$data = [
    'label' => __('Save TodoItem'),
    'class' => 'save primary',
    'data_attribute' => [
        'mage-init' => ['button' => ['event' => 'save']],
        'form-role' => 'save',
    ],
    'sort_order' => 90,
];我知道在ui_component配置文件中,有
<item name="submit_url" xsi:type="url" path="path/to/save"/>两种操作都成功执行了同一Save.php文件,这很有意义。令我感到困惑的是,data_attribute以及如何SaveAndContinueButton  传递参数“ back”,以便它知道停留在同一页面而不是转到网格(通常网格是表单的入口,也就是编辑页面)。
如果我们再看一看deleteButton,那是另一种风景
$data = [
    'label' => __('Delete'),
    'class' => 'delete',
    'on_click' => 'deleteConfirm(\'' . __(
        'Are you sure you want to do this?'
    ) . '\', \'' . $this->getDeleteUrl() . '\')',
    'sort_order' => 20,
];它直接执行onClick JavaScript事件。任何想法/建议将不胜感激。谢谢
还有一个问题:data_attribute和的区别是on_click什么?还是一个比另一个更有利?