Files
xk-api-yii/admin/components/UI/Table/Column/Hidden.php
2024-09-19 11:32:39 +08:00

43 lines
1.1 KiB
PHP

<?php
namespace admin\components\UI\Table\Column;
/**
* Class Hidden
*/
class Hidden implements Component
{
/**
* @param $label
* @return array
*/
public function render($label): array
{
$name = $label . '_show';
return [
'nodeName' => 'div',
'child' => [
[
'nodeName' => 'span',
'class' => 'mr-2',
'vIf' => "rowData.record['$name']",
'child' => "{{rowData.record['$label']}}",
],
[
'nodeName' => 'a-button',
'shape' => 'round',
'size' => 'mini',
'type' => 'outline',
'vBind:status' => "rowData.record['$name'] ? 'warning' : ''",
'class' => 'mr-2',
'vOn:click' => "rowData.record['$name'] = !rowData.record['$name']",
'child' => "{{rowData.record['$name'] ? '隐藏' : '显示'}}",
],
]
];
}
}