Vue.js data-bind style backgroundImage not working

后端 未结 9 1316
耶瑟儿~
耶瑟儿~ 2020-12-12 16:18

I\'m trying to bind the src of an image in an element, but it doesn\'t seem to work. I\'m getting an \"Invalid expression. Generated function body: { backgroundImage:{ url(

9条回答
  •  悲&欢浪女
    2020-12-12 16:38

    For single repeated component this technic work for me

    computed: { img_section_style: function(){ var bgImg= this.post_data.fet_img return { "color": "red", "border" : "5px solid ", "background": 'url('+bgImg+')' } }, }

提交回复
热议问题