button 新增按钮权限功能

This commit is contained in:
JaguarJack 2021-05-08 07:31:41 +08:00
parent 58aea6c0db
commit c40b03a222
2 changed files with 54 additions and 13 deletions

View File

@ -14,9 +14,9 @@ class Actions
* @time 2021年03月23日
* @param string $text
* @param string $event
* @return mixed
* @return Button
*/
public static function create(string $text = '新建', string $event = 'handleCreate')
public static function create(string $text = '新建', string $event = 'handleCreate'): Button
{
return self::normal($text, 'primary',$event)->icon('el-icon-plus');
}
@ -27,9 +27,9 @@ class Actions
* @time 2021年03月23日
* @param string $text
* @param string $event
* @return mixed
* @return Button
*/
public static function update(string $text = '更新', string $event = 'handleUpdate')
public static function update(string $text = '更新', string $event = 'handleUpdate'): Button
{
return self::normal($text, 'primary', $event)->icon('el-icon-edit');
}
@ -40,9 +40,9 @@ class Actions
* @time 2021年03月23日
* @param string $text
* @param string $event
* @return mixed
* @return Button
*/
public static function delete(string $text = '删除', string $event = 'handleDel')
public static function delete(string $text = '删除', string $event = 'handleDel'): Button
{
return self::normal($text, 'danger', $event)->icon('el-icon-delete');
}
@ -54,9 +54,9 @@ class Actions
* @param string $text
* @param string $type
* @param string|null $event
* @return mixed
* @return Button
*/
public static function view(string $text = '查看', $type = 'success', string $event = 'handleView')
public static function view(string $text = '查看', $type = 'success', string $event = 'handleView'): Button
{
return self::normal($text, $type, $event)->icon('el-icon-view');
}
@ -89,9 +89,9 @@ class Actions
* 导出按钮
*
* @time 2021年04月02日
* @return mixed
* @return Button
*/
public static function export()
public static function export(): Button
{
return self::normal('导出', 'success','handleExport')->icon('el-icon-download');
}
@ -100,9 +100,9 @@ class Actions
* 导入按钮
*
* @time 2021年04月02日
* @return mixed
* @return Button
*/
public static function import()
public static function import(): Button
{
return self::normal('导入', 'warning', 'handleImport')->icon('el-icon-upload2');
}

View File

@ -5,7 +5,13 @@ class Button extends Component
{
protected $el = 'button';
/**
* icon
*
* @time 2021年05月07日
* @param string $icon
* @return $this
*/
public function icon(string $icon): Button
{
$this->attributes['icon'] = $icon;
@ -13,6 +19,13 @@ class Button extends Component
return $this;
}
/**
* 文字
*
* @time 2021年05月07日
* @param string $text
* @return $this
*/
public function text(string $text): Button
{
$this->attributes['label'] = $text;
@ -20,6 +33,13 @@ class Button extends Component
return $this;
}
/**
* 样式
*
* @time 2021年05月07日
* @param string $style
* @return $this
*/
public function style(string $style): Button
{
$this->attributes['class'] = $style;
@ -27,6 +47,13 @@ class Button extends Component
return $this;
}
/**
* 点击事件
*
* @time 2021年05月07日
* @param string $click
* @return $this
*/
public function click(string $click): Button
{
$this->attributes['click'] = $click;
@ -34,6 +61,20 @@ class Button extends Component
return $this;
}
/**
* 权限 action 指令
*
* @time 2021年05月07日
* @param string $action
* @return $this
*/
public function permission(string $permission): Button
{
$this->attributes['permission'] = $permission;
return $this;
}
/**
* 支持路由跳转
*