* [story #69184, doing] add commands to load api data in DocApp.
This commit is contained in:
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user