Isk*_*lla 5 polymer polymer-1.0
我认为,我在应用新条件模板时遇到了麻烦,尤其是条件本身.
我有这样的事情:
<template is="dom-repeat" items="{{menuitems}}" as="poscol">
<template is="dom-if" if="{{index != 4}}">
<div class="positioncolum horizontal layout center wrap flex">
<span>{{index}}</span>
<template is="dom-repeat" items="{{poscol}}" as="mitem" >
<main-menu-item mitem="{{mitem}}"
order="{{mitem.TotalOrder}}"
onclick="clickMainMenuMod(index)">
</main-menu-item>
</template>
</div>
</template>
</template>
Run Code Online (Sandbox Code Playgroud)
现在,如果我评论该<template is="dom-if" if="{{index != 4}}">位它工作正常,索引显示它应该.在第四个阵列上存储了用户选择为不可见的模块,因此它们不应出现在主菜单上.
我想if条件有问题,但我不知道是什么.
谢谢!
vas*_*sek 11
尝试修改您的条件模板,如下所示:
<template is="dom-if" if="{{show(index)}}">
Run Code Online (Sandbox Code Playgroud)
并将此函数添加到Polymer脚本:
show: function (index) {
return index != 4;
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
7919 次 |
| 最近记录: |