From 4fd22f69becfc4fed7dd69d80cb99bf55be412f8 Mon Sep 17 00:00:00 2001 From: chenlong Date: Mon, 5 Aug 2024 18:34:14 +0800 Subject: [PATCH] . --- Admin/View/Document/view_api_info.php | 6 +++--- Admin/View/Document/view_param.php | 20 ++++++++++++++++---- 2 files changed, 19 insertions(+), 7 deletions(-) diff --git a/Admin/View/Document/view_api_info.php b/Admin/View/Document/view_api_info.php index 2d17ede..663e21d 100644 --- a/Admin/View/Document/view_api_info.php +++ b/Admin/View/Document/view_api_info.php @@ -48,12 +48,12 @@ $apiInfo = El::double('el-card')->setAttr('v-if', 'currentApiInfo')->append( El::double('template')->setAttr('#label')->append( El::double('span')->setAttr('v-if', 'param.version > 1') ->setAttr('style', 'color:#67C23A') - ->text('V{{ param.version }} {{ param.describe }}'), + ->text('V{{ param.version }} {{param.name}}<{{ param.type }}>{{ param.describe }}'), El::double('span')->setAttr('v-else-if', 'param.version < 0') ->setAttr('style', 'color:#F56C6C;text-decoration: line-through;') - ->text('V{{ Math.abs(param.version) }} {{ param.describe }}'), + ->text('V{{ Math.abs(param.version) }} {{param.name}}<{{ param.type }}>{{ param.describe }}'), El::double('span')->setAttr('v-else', 'param.version < 0') - ->text('{{ param.describe }}') + ->text('{{param.name}}<{{ param.type }}>{{ param.describe }}') ), El::double('el-input')->setAttr('v-if', "param.type === 'Integer' || param.type === 'Float'") ->setAttr('v-model.number', 'apiFormData[param.name]'), diff --git a/Admin/View/Document/view_param.php b/Admin/View/Document/view_param.php index f987bcf..726b349 100644 --- a/Admin/View/Document/view_param.php +++ b/Admin/View/Document/view_param.php @@ -8,7 +8,7 @@ $el = El::double('el-card')->setAttr('v-if', 'currentApiInfo')->append( El::double('el-tabs')->setAttr('v-model', 'showParamInfo') ->setAttr('@tab-change', 'apiShowType')->append( El::double('el-tab-pane')->setAttr('label', '请求参数')->setAttr('name', 'request')->append( - Table::create([])->setAttr('row-key', 'name')->addColumns( + Table::create([], 'rep')->setAttr('row-key', 'name')->addColumns( Table\Column::normal("参数名", 'name')->align('left')->setAttr('width', 200)->setFormat( El::fictitious()->append( El::double('span')->setAttr('v-if', 'version > 1') @@ -24,10 +24,10 @@ $el = El::double('el-card')->setAttr('v-if', 'currentApiInfo')->append( Table\Column::normal("类型", 'type'), Table\Column::normal("必须", 'required'), Table\Column::normal("描述", 'describe')->setAttr('width', 200), - )->render()->find('el-table')->setAttr(':data', 'currentApiInfo.requestParams'), + )->setMaxHeight()->render()->find('el-table')->setAttr(':data', 'currentApiInfo.requestParams'), ), El::double('el-tab-pane')->setAttr('label', '响应参数')->setAttr('name', 'response')->append( - Table::create([])->setAttr('row-key', 'name')->addColumns( + Table::create([],'rsp')->setAttr('row-key', 'name')->addColumns( Table\Column::normal("参数名", 'name')->align('left')->setAttr('width', 200)->setFormat( El::fictitious()->append( El::double('span')->setAttr('v-if', 'version > 1') @@ -43,10 +43,22 @@ $el = El::double('el-card')->setAttr('v-if', 'currentApiInfo')->append( Table\Column::normal("类型", 'type'), Table\Column::normal("必须", 'required'), Table\Column::normal("描述", 'describe')->setAttr('width', 200), - )->render()->find('el-table')->setAttr(':data', 'currentApiInfo.responseParams'), + )->setMaxHeight(-170)->render()->find('el-table')->setAttr(':data', 'currentApiInfo.responseParams'), ) ) ); +$newMounted = []; +foreach (\Sc\Util\HtmlStructure\Html\Html::js()->vue->getConfig('mounted') as $index => $item) { + + if ($item instanceof \Sc\Util\HtmlStructure\Html\Js\JsCode && str_contains($item->toCode(), 'maxHeight')) { + $code = strtr(\Sc\Util\HtmlStructure\Html\Js\Grammar::extract($item), ['setTimeout(() => {' => '', '})' => '']); + $code = trim($code); + $item = \Sc\Util\HtmlStructure\Html\Js\JsCode::create("let i$index = setInterval(() => { try{ $code; clearInterval(i$index); } catch (e) {} }, 10)"); + } + $newMounted[] = $item; +} + +\Sc\Util\HtmlStructure\Html\Html::js()->vue->config('mounted', $newMounted); return $el; \ No newline at end of file