<view class="bg-img bg-mask flex align-center"
style="background-image: url('{{img_back.img}}');height: 414upx;">
<view class="padding-xl text-white">
<view class="padding-xs text-xxl text-bold">
{{img_back.title}}
</view>
<view class="padding-xs text-lg">
{{img_back.desc}}
</view>
</view>
</view>
这个 style 俩边的图片链接该怎么写啊?我按照小程序模板语法可以这么写,vue 这样写好像不对。
![]() |
1
sjhhjx0122 133 天前
把 style 写成变量 直接:style="style" ? 好久没写小程序忘记语法了
|
![]() |
2
yaphets666 133 天前
:style="'background-image: url'+({{img_back.img}})+';height: 414upx;'"
|
![]() |
3
yaphets666 133 天前
上面多了两个大括号,:style="'background-image: url('+img_back.img+');height: 414upx;'"
|
4
Danswerme 133 天前
:style="`background-image: url(${img_back.img});height: 414upx;`"
|
5
chunhai OP @yaphets666 懂了懂了,感谢哈哈
|