How i can bind item.image to style="background-image:url()"
<div rv-each-item="items">
<div style="background-image:url()"></div>
</div>
As shown in this RIVETS Documentation
One-way binders
rivets.binders.color = function(el, value) {
el.style.color = value
}
<button rv-color="label.color">Apply</button>
I fixed this issue
<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 + ')';
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.