EmberJS渲染延迟

时间:2014-12-09 23:09:13

标签: javascript jquery templates ember.js rendering

我有一个打印按钮,使用{{#if}}条件来显示框何时展开。我想要展开框,然后在框的底部显示打印图标。但由于某种原因,它会提前渲染并与折叠的盒子一致显示,然后在盒子完全展开后放入正确的位置。这是我的代码:

打印图标模板:

{{#if view.showPrintButton}}
<div class="print pull-right">
    <a href="/_layouts/irp/print.html#{{unbound id}}" target="_blank">Print Discussion<i class="fa fa-print"></i></a>
</div>
{{/if}}

框模板:

{{#if permissions.comment}}
<div {{bindAttr class="controller.audienceIsShared:shared view.commentEditorExpanded:expanded   :createComment"}}>
<div class="author-image-container content">
    <a href="#/author/{{unbound Informal.Registry.user.id}}"><img src="{{unbound Informal.Registry.user.pictureUrl}}" class="author-image pull-left" /></a>
</div>
{{#if view.commentEditorExpanded}}
<div class="comment-editor-container content">
    <div class="boxSizingDefault text">
        {{
            view view.commentEditorClass
            disabledBinding="view.commentFormDisabled"
            viewName="commentEditor"
            valueBinding="controller.commentInProgress.initialBody"
            attachmentsBinding="controller.commentInProgress.attachments"
        }}
    </div>
    {{#if controller.audienceIsShared}}
        <div class="contextualMessage">This comment will be seen across business units</div>
    {{/if}}
</div>
{{#if notificationRecipients.length}}
<div class="notificationRecipients small detail">
    <span>These subscribers will be notified of your comment:</span>
        {{#if notificationRecipientsIsExpandable}}
            {{#if view.notificationRecipientsExpanded}}
                {{#with sortedNotificationRecipients}}{{> initials}}{{/with}}
            {{else}}
                {{#with collapsedNotificationRecipients}}{{> initials}}{{/with}}
    <span class="link" {{action "expandNotificationRecipients" target="view"}}>
            , {{collapsedNotificationRecipientsRemainingCount}} more...
    </span>
            {{/if}}
        {{else}}
            {{#with sortedNotificationRecipients}}{{> initials}}{{/with}}
        {{/if}}
</div>
    {{/if}}

查看:

    showPrintButton: function () {           
        return (this.get("expanded") !== false) && !this.get("editorExpanded");
    } .property("expanded", "editorExpanded")

谢谢!

0 个答案:

没有答案
相关问题