AEM 6.2(此处拖动组件)Parsys height 0px

时间:2017-06-19 18:48:03

标签: components aem

我正在使用AEM 6.2并尝试使用下面的代码在crx中创建一个parsys组件     

enter image description here

但是,在编辑模式下,此parsys的高度为0px。

附上截图。

enter image description here

当我手动将高度更改为某些值时,例如。 40px,看起来不错。 enter image description here

注意:我没有在上面的页面中使用任何客户端库。 (没有css和js)

此外,像geomatrix等所有样本网站都有正确显示的解析。

有人能指导我做错了吗?

4 个答案:

答案 0 :(得分:3)

我认为问题出在组件或此处显示的任何代码之外。

我认为正在发生的事情是div的css样式为droptarget占位符提供了它的尺寸不会加载。

这是作为AEM创作客户端库的一部分加载的,您应该从基础页面组件继承它。

检查页面组件的sling:resourceSuperType属性。它应该指向wcm / foundation / components / page或wcm / foundation / components / page,或者从一个组件继承。

如果设置了那么你可能已经阻止了其中的一个脚本,很可能是head.html。

答案 1 :(得分:2)

在页面组件的渲染脚本的head部分中包含以下代码。

<!--/* Include Adobe Dynamic Tag Management libraries for the header 
<sly data-sly-include="/libs/cq/cloudserviceconfigs/components/servicelibs/servicelibs.jsp" data-sly-unwrap/>
*/-->
  <!--/* Initializes the Experience Manager authoring UI */-->
<sly data-sly-include="/libs/wcm/core/components/init/init.jsp" data-sly-unwrap/>

答案 2 :(得分:1)

我认为@ l-klement正确地指出了问题是在组件之外。当我将landingpage.html文件重命名为body.html时,它开始正常工作。我认为这可能是因为wcm/foundation/components/page中存在的head.html等不同文件需要提供适当的样式并加载某些必需的客户端库,这些库为parsys分配了适当的样式。

如果上述情况属实,我的下一个问题是,如何才能拥有自己的head.html,body.html,header.html,footer.html等文件,而不会影响使用它们的样式?

答案 3 :(得分:1)

为解决您的问题,您需要在写下parsys代码之前首先包含init.jsp。我的意思是这样写。

<?xml version="1.0"?>
  <ruleset name="Amit">
  <description>My Custom on top of PSR2</description>

  <rule ref="PSR2">
    <exclude name="PSR2.Classes.ClassDeclaration"/>
    <exclude name="PSR2.ControlStructures.SwitchDeclaration"/>
   <exclude name="PSR2.Methods.FunctionCallSignature"/>
 </rule>

 <rule ref="Generic.Arrays.ArrayIndent">
   <properties>
     <property name="indent" value="2"/>
   </properties>
 </rule>

<rule ref="Generic.WhiteSpace.ScopeIndent">
  <properties>
    <property name="indent" value="2"/>
  </properties>
</rule>

<rule ref="PSR2.Classes.ClassDeclaration">
  <properties>
    <property name="indent" value="2"/>
  </properties>
</rule>

<rule ref="PSR2.ControlStructures.SwitchDeclaration">
  <properties>
    <property name="indent" value="2"/>
  </properties>
</rule>

<rule ref="PSR2.Methods.FunctionCallSignature">
  <properties>
    <property name="indent" value="2"/>
    <property name="requiredSpacesAfterOpen" value="1"/>
    <property name="requiredSpacesBeforeClose" value="1"/>
  </properties>
</rule>


<rule ref="PEAR.ControlStructures.MultiLineCondition">
  <properties>
    <property name="indent" value="2"/>
  </properties>
</rule>


<rule ref="PEAR.Formatting.MultiLineAssignment">
  <properties>
    <property name="indent" value="2"/>
  </properties>
</rule>

<rule ref="PEAR.Functions.FunctionDeclaration">
  <properties>
    <property name="indent" value="2"/>
  </properties>
</rule>
</ruleset>