Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/vue.js/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
&引用;背景图片:url(“背景”),什么是+;签约?Vue.js_Vue.js - Fatal编程技术网

&引用;背景图片:url(“背景”),什么是+;签约?Vue.js

&引用;背景图片:url(“背景”),什么是+;签约?Vue.js,vue.js,Vue.js,“背景图像:url(“+bg+”),符号“+”代表什么?Vue.js 作为标题。我不明白为什么url()中添加了+符号 任何答复都将不胜感激 符号+不代表url。这里它被用作字符串连接运算符。它将第二个字符串添加到第一个字符串的末尾。例如“a”+“b”等于“ab” 您的函数正在返回一个字符串。如果this.poinifo.head\u pic\u url的值是,比如说,www.example.com/head\u pic,那么函数content\u bg()将返回背景图像:url(www.exa

“背景图像:url(“+bg+”),符号“+”代表什么?Vue.js

作为标题。我不明白为什么url()中添加了+符号


任何答复都将不胜感激

符号
+
不代表url。这里它被用作字符串连接运算符。它将第二个字符串添加到第一个字符串的末尾。例如
“a”+“b”
等于
“ab”

您的函数正在返回一个字符串。如果
this.poinifo.head\u pic\u url
的值是,比如说,
www.example.com/head\u pic
,那么函数
content\u bg()
将返回
背景图像:url(www.example.com/head\u pic)
的字符串值


您只需在javascript中连接一个字符串。将添加哪些字符串。poiInfo.head_pic_url
背景图像:url(
将添加在
此值之前。poiInfo.head_pic_url
)将添加在此值之后。
computed:{
        content_bg(){
            return "background-image:url(" + this.poiInfo.head_pic_url + ")"
        },
content_bg(){
    return "background-image:url(" + this.poiInfo.head_pic_url + ")"
},