Vue.js data-bind style backgroundImage not working

后端 未结 9 1318
耶瑟儿~
耶瑟儿~ 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:42

    I experienced an issue where background images with spaces in the filename where causing the style to not be applied. To correct this I had to ensure the string path was encapsulated in single quotes.

    Note the escaped \' in my example below.

提交回复
热议问题