wxml
<view class="table">
<view class="tr bg-header">
<view class="th">学号</view>
<view class="th">姓名</view>
<view class="th">性别</view>
<view class="th">班级</view>
</view>
<block wx:for="{{list}}" wx:key="unique">
<view class="tr bg-items">
<view class="td">{{item.bookname}}</view>
<view class="td">{{item.author}}</view>
</block>
</view>
js
onLoad: function (options) {
var list = JSON.parse(options.tobookname)
console.log(list)
},
这是传递后list打印出来的信息
为什么我在wxml的<view class="td">{{item.bookname}}</view>
<view class="td">{{item.author}}</view>无法打印
这是无法打印的结果
多看看文档 this.setData({ list:list })
data: {
bookname:[],
author:[],
booklist:[]
},
onLoad: function (options) {
var booklist = JSON.parse(options.tobookname)
console.log(booklist);
this.setData({
booklist:booklist,
})
},
wxml:
<block wx:for="{{booklist}}" wx:key="unique">
<view class="tr bg-items">
<view class="td">{{item.bookname}}</view>
<view class="td">{{item.author}}</view>
this.setData({
booklist:booklist.data
})