const app = getApp() var http = require("../../utils/config.js"); Page({ data: { setting: '', areaList: [], index: 0, }, getAreas: function () { wx.showLoading({ title: '加载中...', }) app.request('/areas', '', 'get').then(res => { console.log(res) let areaId = wx.getStorageSync('home').id let list = res.data let index = 0 list.map((item, index) => { if (item.id == areaId) { index = index } }) if (res.statusCode == 200) { this.setData({ areaList: res.data, setting: list[index].setting, index }) } wx.hideLoading() }) }, // 点击筛选区域 bindPickerChange(e) { console.log(e, 'pppppp') let index=e.detail.value index=Number(index) this.setData({ index, setting:this.data.areaList[index].setting }) }, onLoad: function (options) { }, onReady: function () { }, onShow: function () { this.getAreas() }, onHide: function () { }, onUnload: function () { }, onPullDownRefresh: function () { }, onReachBottom: function () { }, onShareAppMessage: function () { } })