我如何将 item.image 绑定到 style =“ background-image:url()”
<div rv-each-item="items">
<div style="background-image:url()"></div>
</div>
所示
单向活页夹
rivets.binders.color = function(el, value) {
el.style.color = value
}
<button rv-color="label.color">Apply</button>
答案 0 :(得分:0)
我已解决此问题
<div rv-each-item="items">
<div rv-view-style="item.image"></div>
</div>
**JS**
rivets.binders['view-style'] = function(el, value) {
el.style = 'background-image:url(https://xxx/' + value + ')';
}