<dom-if" if="{{_isShowCategory(category.name)}}>
即使条件为假,我也无法弄清楚为什么我的内部模板正在呈现。我打印出布尔结果,并且if
条件正确评估为false
when category.name
is 'account'
,但仍然是模板呈现。
<dom-if if="[[_shouldRenderDrawer]]">
<template>
<!-- Two-way bind `drawerOpened` since app-drawer can update `opened` itself. -->
<app-drawer opened="{{drawerOpened}}" swipe-open tabindex="0">
<a name="account" href="/account">ACCOUNT</a>
<iron-selector role="navigation" class="drawer-list" selected="[[categoryName]]" attr-for-selected="name">
<dom-repeat items="[[categories]]" as="category" initial-count="4">
<!-- NOTE: I've also tried <dom-if if="{{_isShowCategory(category.name)}}> but I get the same result -->
<template is="dom-if" if="{{_isShowCategory(category.name)}}">
<span style="color:black">{{_isShowCategory(category.name)}}</span>
<a name="[[category.name]]" href="/[[category.name]]">[[category.title]]</a>
</template>
</dom-repeat>
</iron-selector>
</app-drawer>
</template>
</dom-if>
_isShowCategory(categoryName){
return !Boolean(categoryName === "account");
// I've also tried return !(categoryName==='account'), which returns the same result as the above
}