我想在jQuery中获取路径/content/branc/region/microsite_name/en/mypage/jcr:content/par/mycomponent
。
我可以使用Granite.author.page获取页面路径。
代码获取页面路径:
(function ($, $document, author) {
"use strict";
$(document).on("dialog-ready", function() {
var path = author.page`enter code here`.path; //This works
var component = author.component.path; //This is not working
console.log("component path " +component);
});
})($, $(document), Granite.author);
请建议如何在jQuery中获取组件路径。
Granite.author.DialogFrame.currentDialog.editable.type
中的ResousceType可用。类型字段中的路径不是绝对的,并且缺少"/应用程序或/libs"部分。如果您对绝对路径感兴趣,请尝试Granite.author.DialogFrame.currentDialog.editable.config.dialog
正如 @sharath-madappa指出,resourceType
可从Granite.author.DialogFrame.currentDialog.editable.type
获得。
如果您想要调用对话框组件的确切路径,则可以使用Granite.author.DialogFrame.currentDialog.editable.path
。
有关它的更多文档:https://helpx.adobe.com/experience-manager/6-3/sites/developing/ususe/reference-materials/jsdoc/jsdoc/ui-touch/editor-coretor/editor-core/granite.author.author。DialogFrame.html