* [story #69184, doing] add commands to load api data in DocApp.

This commit is contained in:
sunhao
2024-11-13 09:22:31 +08:00
committed by 刘刚
parent 301a5b5476
commit df5a35f9e9
+20
View File
@@ -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.