* [ui] support open next and prev url in detail page by hotkey.

This commit is contained in:
sunhao
2024-08-28 13:55:22 +08:00
committed by 刘刚
parent 87180084ca
commit efeb4aa5a3
+13
View File
@@ -544,6 +544,19 @@ CSS;
$this->buildBody(),
$layout === 'simple' ? null : $this->buildPrevAndNext(),
html($app->control->appendExtendCssAndJS('', '', $this->prop('object'))),
js
(
'const $doc = $(document)',
'const binddedKey = "zt.detail.bindded"',
'if($doc.data(binddedKey)) return',
'$doc.on("keyup.detail.zt", e => {',
'let $btn = null',
'if(e.keyCode === 37) $btn = $(".detail-prev-btn")',
'else if(e.keyCode === 39) $btn = $(".detail-next-btn")',
'if($btn && $btn.length) $btn[0].click()',
'}).data(binddedKey, true)',
'$doc.one("pageunmount.app", () => {$(document).off("keyup.detail.zt").removeData(binddedKey)})'
)
);
}
}