所以看起来很适合获取属性,但我想努力获取我定义的其他子节点的属性。
这是我的 PictureFill 组件结构的开始:
{
jcr:primaryType: "nt:unstructured",
jcr:createdBy: "admin",
fileReference: "/content/dam/myapp/dev/hero-billboard.jpg",
jcr:lastModifiedBy: "admin",
jcr:created: "Wed Oct 07 2015 03:38:00 GMT+0000",
jcr:lastModified: "Wed Oct 07 2015 16:54:12 GMT+0000",
sling:resourceType: "myapp/components/content/image",
cq:responsive: {
jcr:primaryType: "nt:unstructured"
},
mobile: {
jcr:primaryType: "nt:unstructured",
path: "/content/dam/myapp/dev-testing/placeholder/FPO-hero-sm.jpg"
},
tablet: {
jcr:primaryType: "nt:unstructured"
},
desktop: {
jcr:primaryType: "nt:unstructured"
},
extralg: {
jcr:primaryType: "nt:unstructured"
}
}
所以我卡住的部分是我将如何在移动、平板电脑、桌面和 extralg 节点上设置属性。
我想重用从 utils/Image.js 获得的尽可能多的 OOTB 功能,而不是重新构建它,这就是我走 Java 路线的原因。