给出 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/