success: function (res) {
that.setData({
listData: res.data.StaffDetail
})
}
<block wx:for="{{listData}}" wx:for-item=“item”>
<view class=“tr”>
<view class=“td-2”>{{item.SubjectPname}}</view>
<view class=“td-2”>{{item.Price}}</view>
<view class=“td-2”>{{item.SubTotal}}</view>
<view class=“td-2”>{{item.Number}}</view>
</view>
</block>
渲染失败,
res.data.StaffDetail数据是
【
{“SubjectPname”:“技术负责人”,“SubjectName”:null,“Price”:“0.4~0.6”,“SubTotal”:“0.4~0.6”,“Number”:1},
{“SubjectPname”:“中级职称”,“SubjectName”:“结构;材料或化工;(必齐全)”,“Price”:“0.67~0.7”,“SubTotal”:“2~2.1”,“Number”:3}
】
如果这样的话就能渲染成功:
success: function (res) {
that.setData({
listData:
【
{“SubjectPname”:“技术负责人”,“SubjectName”:null,“Price”:“0.4~0.6”,“SubTotal”:“0.4~0.6”,“Number”:1},
{“SubjectPname”:“中级职称”,“SubjectName”:“结构;材料或化工;(必齐全)”,“Price”:“0.67~0.7”,“SubTotal”:“2~2.1”,“Number”:3}
】
})
}
<block wx:for="{{listData}}" wx:for-item=“item”>
<view class=“tr”>
<view class=“td-2”>{{item.SubjectPname}}</view>
<view class=“td-2”>{{item.Price}}</view>
<view class=“td-2”>{{item.SubTotal}}</view>
<view class=“td-2”>{{item.Number}}</view>
</view>
</block>
{“SubjectPname”:“技术负责人”,“SubjectName”:null,“Price”:“0.4~0.6”,“SubTotal”:“0.4~0.6”,“Number”:1},
{“SubjectPname”:“中级职称”,“SubjectName”:“结构;材料或化工;(必齐全)”,“Price”:“0.67~0.7”,“SubTotal”:“2~2.1”,“Number”:3},
{“SubjectPname”:“八大员”,“SubjectName”:“质量员;施工员;安全员;造价员;”,“Price”:“0.3”,“SubTotal”:“3”,“Number”:10},
{“SubjectPname”:“技工”,“SubjectName”:“中级技工证;”,“Price”:“0.1”,“SubTotal”:“1.5”,“Number”:15}