Theo VueJS
tài liệu:VueJS v-ràng buộc: phong cách cho background-image: url()
<div v-bind:style="{ color: activeColor, fontSize: fontSize + 'px' }"></div>
Tôi đã thử một vài mẫu:
<div v-bind:style="{ background-image: url(item.img), }"></div>
<div v-bind:style="{ 'background-image': url('item.img'), }"></div>
<div v-bind:style='{ backgroundImage: "url(item.img)", }'></div>
Nhưng kết quả không hợp lệ cho thuộc tính HTML style
.
Bất kỳ ý tưởng nào?