// pages/lianxi/index.js const api = require("../../../utils/request.js"); Page({ data: { results: [], count:1, query: { page: 1, limit: 10, search:'', compound_cate:'' }, arrayIndex:null, array: ['醇类', '醛类', '酸类', '酯类', '酮类', '醚类', '酚类', '苯系物', '卤代物', '烷烃类', '烯烃类', '硫化物', '胺类', '其他'], listData:[], }, onLoad: function () { this.getList(); }, onShow: function () { }, searchChange(e){ var that = this; that.setData({ listData:[], ['query.page']:1, ['query.search']:e.detail.value }) that.getList(); }, searchClear(){ this.setData({ ['query.search']:'', ['query.page']:1, ['query.compound_cate']:'', listData:[], arrayIndex:null, }) this.getList(); }, getList () { var that = this; console.log(that.data.query) api.request('/cms/threshold/', 'GET',that.data.query).then(res => { let list = res.data.results; let dataList = that.data.listData; for(let i = 0;i that.data.listData.length) { that.setData({ ['query.page']:that.data.query.page + 1, }) that.getList() } else { wx.showToast({ title: '没有更多了', icon: 'none' }) } }, })