我想根据元素中传递的属性显示模板。
说
<template>
<template is="dom-if" if="[[!multiLine]]">
..
</template>
<template is="dom-if" if="[[multiLine]]">
..
</template>
</template>
在我传递的属性中
properties:{
multiLine: {
type: Boolean,
value: false
}
}
并且在html中我只能将多行作为属性传递。 我怎样才能实现这个目标?它总是在第一个。
最佳答案
如果您在 dom-bind
模板之外的元素中添加 multi-line
属性,则其计算结果始终为 true
,无论您传递的值是什么,尽管您可以通过不在元素上添加属性或在 js 中使用虚假值将其设置为 false
。
关于javascript - Polymer 1.0 Dom-if 检查属性,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30603728/