Ajax 与聚合物。响应后渲染

Ajax with polymer. render after response

我尝试用聚合物铁制作ajax-ajax。

我的问题是,有些元素只有在我收到响应后才能呈现,否则它们就不是要呈现的数据。

我如何"stop" 渲染元素直到他们响应?

谢谢

两个选项:

  1. 在 ajax 调用完成之前向 div 或要隐藏的元素添加条件 hidden 属性:

    <div hidden$="[[!response]]"></div>

    或使用计算绑定处理可见性

    <div hidden$="[[_computeIsHidden(response)]]"

  2. 将您的内容包装在 dom-if 模板中:

    <template is="dom-if" if="[[_computeIsHidden(response)]]">

只是: <template is="dom-if" if="[[response]]">