0
考慮這種聚合物元素聚合物模板使用HTML屬性
<polymer-element name="my-card" attributes="title content">
<template>
<div style="padding:20px; max-width:600px; margin:50px; margin-bottom:0px" on-tap={{cardTapped}}>
<paper-shadow z="1">
<div class="row">
<div class="col-xs-12" style="margin-top:-20px"><h2>{{title}}</h2></div>
</div>
<hr/>
<div class="row">
<div class="col-xs-12">{{content}}</p></div>
</div>
<paper-ripple fit></paper-ripple>
</paper-shadow>
</div>
</template>
<script>
Polymer({
cardTapped: function(){
alert('tapped!');
}
});
</script>
</polymer-element>
這是我如何使用它
<my-card content="this is a test body" title="Here is a nice Title"></my-card>
它的工作原理,但是當我在內容使用HTML屬性像
<my-card content="this is a test body <p>with paragraphs</p>" title="Here is a nice Title"></my-card>
它們像文本一樣處理,是否有任何方法可以將HTML代碼傳遞給屬性並將其嵌入到聚合物模板中