mirror of
https://gitee.com/ulthon/ulthon_information.git
synced 2026-03-04 00:24:29 +08:00
feat: 完成三方平台发布管理
This commit is contained in:
33
extend/think/response/Htmx.php
Normal file
33
extend/think/response/Htmx.php
Normal file
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
namespace think\response;
|
||||
|
||||
use think\Response;
|
||||
|
||||
class Htmx extends Response
|
||||
{
|
||||
protected $triggerOptions = [];
|
||||
|
||||
public function addTrigger($name, $data = null)
|
||||
{
|
||||
$this->triggerOptions[$name] = $data;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function message($message)
|
||||
{
|
||||
$this->triggerOptions['layerMsg'] = ['type' => 1, 'title' => $message];
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
protected function output($data)
|
||||
{
|
||||
$this->header([
|
||||
'HX-Trigger' => json_encode($this->triggerOptions),
|
||||
]);
|
||||
|
||||
return parent::output($data);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user