拼接字符串

    xiaoxiao2021-03-26  15

    因为vue总是涉及到字符串的拼接,变量和字符串怎么拼接在一起呢?

    v-bind:style="{backgroundImage:'url('+list.img+')'}"

    v-bind:src=" 'http://www.wmh920/'+list.img"      http://www.wmh920/是固定值。因为list.img这种变量本来就是放在""里面的。

    带变量的html内容:'+变量名+'

    var ht='<i class="c '+data[i].is_b+'">审核时间</i>'; 

            var img="images/goods.jpg";         $("#bg_test").css({"background":"url("+img+") no-repeat center center","height":"200px","background-size":"cover"});  //一定要写高度否则不显示

    转载请注明原文地址: https://ju.6miu.com/read-450160.html

    最新回复(0)