0

我被一个不渲染的闪电组件困住了。我立即收到一个奇怪的错误:此页面有错误。您可能只需要刷新它。初始化期间出错 [无法读取未定义的属性“应用”]。

我现在卡了很长时间,无法弄清楚代码有什么问题。在这里你可以看到我的代码:

零件:

<aura:attribute name="recordId" type="String" default='500b000000cOxah' />
<aura:attribute name="case" type="Case" />
<aura:attribute name="tasks" type="Task[]"/>

<aura:handler name="init" value="{!this}" action="{!c.doInit}"/>

<c:CaseActivityTrackerHeader />

<aura:iteration items="{!v.tasks}" var="task">
    <c:CaseActivityTrackerTimeline task="{!task}"/>
</aura:iteration>

<aura:iteration items="{!v.tasks}" var="task">
    <h3>{!v.task.Subject}</h3>
</aura:iteration>

<h3>{!v.case.Subject}</h3>
<h3>{!v.recordId}</h3>

({
doInit: function(component, event, helper) {
    //helper.getCase(component, event);
    //helper.getTasks(component, event);
    // Set the attribute value. 
    // You could also fire an event here instead.
    component.set("v.recordId", "controller init magic!");
}

})

应用程序

<aura:application extends="force:slds">

<c:CaseActivityTracker />

<!-- 
<c:camping />
-->

我真的有人可以帮助我!提前致谢 :)

4

2 回答 2

0

找到了!它在 helperclass 中(我现在意识到我没有在此处发布)并且它是一个变量“案例”,SFDC 将其解释为 sobject 案例而不是 var 案例。通过将 var name 更改为“Case”,问题得到了解决

于 2016-11-03T19:09:18.943 回答
0

我的错误是相同的,但问题是在如下函数之后缺少右括号:

action.setCallback(this, function(response){ /* do stuff */ }

但是我的任何错误都没有提到那条线。修复当然是

action.setCallback(this, function(response){ /* do stuff */ });
于 2017-03-23T11:54:11.947 回答