AEM用于获取子节点的属性。 [英] AEM Sightly to get properties of child nodes.

查看:115
本文介绍了AEM用于获取子节点的属性。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以它似乎很适合获取属性,但我想工作获取我定义的其他子节点的属性。

So it looks like sightly is great for getting properties, but I would like to work get properties of other child nodes that I have defined.

这是开始我的PictureFill组件结构:

Here is the start of my PictureFill Component structure:

{
  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节点上设置属性。

So the part I am getting stuck on is how will I get the properties set on the mobile, tablet, desktop and extralg nodes.

我想重用从utils / Image.js中获得的OOTB功能,而不是重建那样,这就是为什么我已经走了Java路线。

I would like to reuse as much OOTB functionality I get from the utils/Image.js instead of rebuilding that so that why I have gone the Java route.

推荐答案

为什么不使用WCMUse Java类或JS使用?

Why don't you use a WCMUse Java class or a JS use?

你正在寻找的是为你想要实现的目标定制,所以你应该拥有自己的控制器并访问子节点的属性,Sightly是一种模板语言,它是有目的的,如果你需要特定的东西创建一个使用Java或JavaScript对象并使用Sightly访问它。

What you are looking for is custom for what you are trying to achieve so you should have your own controller and access the properties of child nodes, Sightly is a templating language, it's made simple on purpose, if you need specific stuff create a Use Java or JavaScript object and access it with Sightly.

这篇关于AEM用于获取子节点的属性。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆