<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 2022-09-20 17:01:42 +08:00
把 style 写成变量 直接:style="style" ? 好久没写小程序忘记语法了
|
2
yaphets666 2022-09-20 17:51:45 +08:00
:style="'background-image: url'+({{img_back.img}})+';height: 414upx;'"
|
3
yaphets666 2022-09-20 17:53:01 +08:00
上面多了两个大括号,:style="'background-image: url('+img_back.img+');height: 414upx;'"
|
4
Danswerme 2022-09-20 21:54:28 +08:00
:style="`background-image: url(${img_back.img});height: 414upx;`"
|
5
chunhai OP @yaphets666 懂了懂了,感谢哈哈
|