在属性中使用对象
Use object in attribute
我想在 html 属性中使用笔记对象的属性
<div id="disco-grid">
<template repeat="{{note in _notes}}">
<disco-pad note="{{note.midi}}"></disco-pad>
</template>
</div>
代码
"{{note.midi}}"
未被评估,只是 returns 它作为一个字符串,我该怎么做?
您的代码是正确的。确保您在元素中指定了 note 属性
<polymer-element name="disco-pad" attributes="note">
如果仍然无效,请尝试在 javascript 文件
中创建一个 _notes 存根
Polymer({
_notes: {
midi: 'something'
}
});
我想在 html 属性中使用笔记对象的属性
<div id="disco-grid">
<template repeat="{{note in _notes}}">
<disco-pad note="{{note.midi}}"></disco-pad>
</template>
</div>
代码
"{{note.midi}}"
未被评估,只是 returns 它作为一个字符串,我该怎么做?
您的代码是正确的。确保您在元素中指定了 note 属性
<polymer-element name="disco-pad" attributes="note">
如果仍然无效,请尝试在 javascript 文件
中创建一个 _notes 存根Polymer({
_notes: {
midi: 'something'
}
});