问怎么在图像控件的路径上使用组合的字符串?
发布于 6 年前 作者 xumin 3837 次浏览 来自 问答

我就想用两个字符串合成图像的真实路径,习惯上用+,结果报错,不知道JS在页面该怎么组合字符串

wxml文件:
<view class = "order_type_button" wx:for="{{order_type}}" wx:key="id">
    <view class = "align_center_hori">
        <image class = "toolbar_botton_icon" mode='scaleToFill' src='../../images/person/' + '{{item.image}}'></image>
    </view>
</view>

js文件:
data: {
    order_type: [
        { image: "order_wait_pay.png" },
        { image: "order_wait_deliver.png" },
        { image: "order_wait_receive.png" },
        { image: "order_finish.png" },
        { image: "order_after_service.png" }
    ]
},


2 回复

<image src=’…/…/images/person/{{item.image}}’>

’ + ’

删除掉

回到顶部