天天看点

SAP UI5 jQuery.sap.getModulePath 的工作原理

SAP UI5 jQuery.sap.getModulePath 的工作原理

该函数用于为某个待加载的 module,构造 URL 以便加载。

SAP UI5 jQuery.sap.getModulePath 的工作原理

首先调用 ui5ToRJS,把 jerrylist.mode, 转换成 jerrylist/mode:

SAP UI5 jQuery.sap.getModulePath 的工作原理

然后对 jerrylist.mode, 调用 jQuery.sap.getResourcePath:

SAP UI5 jQuery.sap.getModulePath 的工作原理

mUrlPrefixes 里的值:

SAP UI5 jQuery.sap.getModulePath 的工作原理

得到 namePrefix:

SAP UI5 jQuery.sap.getModulePath 的工作原理

得到正确的路径:

SAP UI5 jQuery.sap.getModulePath 的工作原理

其实就是 mock.json 在工程里的相对路径:

SAP UI5 jQuery.sap.getModulePath 的工作原理

继续阅读