1、在页面js文件的data中声明变量
Page({ /** * 页面的初始数据 */ data: { CaseList: [] },
2、在对应事件中获取数据,常在onLoad事件中获取,获取到的数据可在控制台的AppData中查看
// pages/CaseManage/CaseManage.js Page({ /** * 页面的初始数据 */ data: { CaseList: [] }, /** * 生命周期函数--监听页面加载 */ onLoad: function (options) { //声明对象 const app = getApp(); //设置全局变量 //app.globalData.OperatorIndex = 100; //获取全局变量 //console.log(app.globalData); // 小程序发起请求 // wx.request({ // url: \'http://sx.flyz12348.cn:7095/CaseAjax.ashx\', // data:{"BranchIndex":610122}, // success:(res)=>{ // console.log(res); // this.setData({ // CaseList:res.data // }); // } // }) //模拟获取到了数据 this.setData({ CaseList: [{ "CaseIndex": 61000000084571, "CaseKind": 10, "CaseMasterKind": 1, "CaseName": "(西蓝)民援字[2020]第13号", "CaseClassifyName": "生命权、健康权、身体权纠纷", "ChargeName": "", "PersonName": "王玉芳", "PersonKindName": "残疾人、农民、老年人、妇女", "AcceptDate": 20200114, "FlowStatusName": "承办中", "UndertakeDepartName": "蓝田县148法律服务所", "UndertakeManName": "孙锁信", "CheckDecision": 1, "AuditDecision": 1, "AddOper": 61012200011113, "AddOperName": "陈军印", "IfGroup": 2, "IfGroupMaster": 2, "ExceptableStatus": 0, "IfDeliver": 2, "IfChestCase": 2, "ChestCaseNo": 9999, "ChestCaseName": "", "GroupCaseNoMin": 0, "GroupCaseNoMax": 0, "GroupCaseCount": 0, "FlowStatus": 50, "Status": 1 }, { "CaseIndex": 61000000092541, "CaseKind": 10, "CaseMasterKind": 1, "CaseName": "(西蓝)民援字[2020]第12号", "CaseClassifyName": "继承纠纷", "ChargeName": "", "PersonName": "郭品南", "PersonKindName": "老年人、妇女、农民", "AcceptDate": 20200114, "FlowStatusName": "指派中", "UndertakeDepartName": "", "UndertakeManName": "", "CheckDecision": 1, "AuditDecision": 1, "AddOper": 61012200011113, "AddOperName": "陈军印", "IfGroup": 2, "IfGroupMaster": 2, "ExceptableStatus": 0, "IfDeliver": 2, "IfChestCase": 2, "ChestCaseNo": 9999, "ChestCaseName": "", "GroupCaseNoMin": 0, "GroupCaseNoMax": 0, "GroupCaseCount": 0, "FlowStatus": 30, "Status": 1 }] }); },
3、在对应的wxml文件中绑定数据
<view> <navigator url="/pages/CaseSet/CaseSet">新增</navigator> </view> <view wx:for="{{ CaseList }}" wx:key="{{ item.CaseIndex }}" class="CaseInfo"> <navigator url="/pages/CaseInfo/CaseInfo?CaseIndex={{item.CaseIndex}}" class="CaseNavigator"> 案号:{{ item.CaseName }} </navigator> <view> 受援人:{{item.PersonName}} </view> </view>
请发表评论