From df5a35f9e9fccb16d6e954b8e92f8f0e08246f07 Mon Sep 17 00:00:00 2001 From: sunhao Date: Wed, 13 Nov 2024 09:12:10 +0800 Subject: [PATCH] * [story #69184, doing] add commands to load api data in DocApp. --- lib/zin/wg/docapp/js/v1.js | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/lib/zin/wg/docapp/js/v1.js b/lib/zin/wg/docapp/js/v1.js index 786a0811c2..f8f9861255 100644 --- a/lib/zin/wg/docapp/js/v1.js +++ b/lib/zin/wg/docapp/js/v1.js @@ -1028,6 +1028,26 @@ const commands = } }); + /** + * 加载指定的 API 文档。 + * Load the specified API doc. + */ + loadApi: function(_, args) + { + const apiID = getApiID(args[0] || this.docID); + const version = args[1] || 0; + const release = args[2] || 0; + const select = !!args[3]; + $.getJSON($.createLink('api', 'ajaxGetApi', `apiID=${apiID}&version=${version}&release=${release}`), function(result) + { + if(!result || typeof result !== 'object') return; + result.id = `api.${apiID}`; + const docApp = getDocApp(); + docApp.update('doc', result); + if(select) docApp.selectDoc(result.id); + }); + }, + /** * 加载懒加载内容。 * Load the lazy content.