polymer 数据绑定(bind), "with"语句?

标签 polymer with-statement

给出 polymer 文档中的这个示例:

<template repeat="{{item in items}}">
  <tr><td> {{item.name}} </td><td> {{item.count}} </td></tr>
</template>

假设“item”有几十个属性,我不想每次都输入“item.property”。是否有类似于典型 With 语句的功能?

最佳答案

不要定义范围:

<template repeat="{{items}}">
  <tr><td> {{name}} </td><td> {{count}} </td></tr>
</template>

关于 polymer 数据绑定(bind), "with"语句?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27392831/

相关文章:

javascript - 将事件添加到 Polymer 中的子菜单标题

javascript - polymer 就绪函数仅调用一次

excel - 当两者在同一工作簿中指定不同的工作表时,我可以将 With 嵌套在 With 中吗?编程语言

javascript - JavaScript 的 "with"语句有合法用途吗?

python - 指令行为的解释

python - 在 Python 中使用 'with .. as' 语句有什么好处?

javascript - Polymer 1.0 移动网络应用程序看起来不正确

javascript - 在 Polymer Js 中,值变化未反射(reflect)在 html 上

javascript - polymer 1.0 中的英雄动画

ansible - 如何使用带有序列和列表的嵌套循环以及如何在 Ansible 中绕过花括号