我有下面的代码:
<template is="dom-if" if="{{item.hasAttach}}">
<i class="fa fa-paperclip"></i>
</template>
Run Code Online (Sandbox Code Playgroud)
item.hasAttach = true/false
但我想检查条件,如果: item.content_format_code =='PDF'
<template is="dom-if" if="{{item.content_format_code == 'PDF'}}">
<i class="fa fa-pdf"></i>
</template>
<template is="dom-if" if="{{item.content_format_code == 'JPEG'}}">
<i class="fa fa-jpg"></i>
</template>
<template is="dom-if" if="{{item.content_format_code == 'xls'}}">
<i class="fa fa-xls"></i>
</template>
Run Code Online (Sandbox Code Playgroud)
它应该像{{item.content_format_code =='PDF'}} = true/false 但它不是测试它.我想根据文件类型显示图标.item.content_format_code =='PDF'未选中true/false.在聚合物中,它仅将真/假作为条件实际值,但不检查表达式.请帮我.