54 lines
1.8 KiB
PHP
54 lines
1.8 KiB
PHP
<?php
|
||
|
||
namespace App\Admin;
|
||
|
||
use Slowlyo\OwlAdmin\Renderers\BaseRenderer;
|
||
|
||
class Components extends BaseRenderer {
|
||
|
||
/**
|
||
* 父级选择器
|
||
*/
|
||
public function parentControl($apiUrl = '', $name ='parent_id', $label ='父级', $labelField = 'name', $valueField = 'id')
|
||
{
|
||
return amisMake()->TreeSelectControl()
|
||
->name($name)->label($label)
|
||
->showIcon(false)
|
||
->labelField($labelField)
|
||
->valueField($valueField)
|
||
->value(0)->source($apiUrl);
|
||
}
|
||
|
||
/**
|
||
* 排序字段
|
||
*/
|
||
public function sortControl($name ='sort', $label = '排序'){
|
||
return amisMake()->NumberControl()
|
||
->name($name)->label($label)
|
||
->value(0)
|
||
->min(0);
|
||
}
|
||
|
||
/**
|
||
* 富文本编辑器
|
||
*/
|
||
public function fuEditorControl($name ='content', $label = '内容', $uploadUrl = ''){
|
||
return amisMake()->RichTextControl()->vendor('tinymce')
|
||
->options([
|
||
"menubar"=>false,
|
||
"min_height" => 500,
|
||
"toolbar"=> "undo redo | formatselect | bold italic backcolor | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | removeformat | link image | help",
|
||
"help_tabs" => []
|
||
])
|
||
->name($name)->label($label);
|
||
|
||
//froala去除授权提示;(但是保存会有额外内容,需要处理)
|
||
//<style type="text/css">
|
||
// a[href="https://froala.com/wysiwyg-editor"], a[href="https://www.froala.com/wysiwyg-editor?k=u"]{
|
||
// display: none !important;
|
||
// position: absolute;
|
||
// top: -99999999px;
|
||
// }
|
||
// </style>
|
||
}
|
||
} |