clickAction({ detail }) { const { index } = detail; this .setData({ [`actions[${index}].loading`]: true }); console.log(detail.index); if (detail.index === 0){ var that = this ; wx.request({ url: 'httpS://hn2.api.okayapi.com/?&service=App.Table.FreeQuery&model_name=safe2&where=[["newID","LIKE","%配方库%"]]&page=1&perpage=500&order=["newID DESC"]&app_key=88DE9116279020C73DFC327&sign=DBEC0C74EAC74C64B9D741F98C78DD15' , header: { 'content-type' : 'application/json' // 默认值 }, success: function (res) { console.log(res.data.data.list) that.setData({ list1: res.data.data.list }); } }) console.log( 'ok' ) this .setData({ classname: '配方库编号▼' }) } else if (detail.index === 1) { var that = this ; wx.request({ url: 'httpS://hn2.api.okayapi.com/?&service=App.Table.FreeQuery&model_name=safe2&where=[["newID","LIKE","%辅料库%"]]&page=1&perpage=500&order=["newID DESC"]&app_key=88DE911C912A3CBB6279020C73DFC327&sign=DBEC0C74EAC74C678DD15' , header: { 'content-type' : 'application/json' // 默认值 }, success: function (res) { console.log(res.data.data.list) that.setData({ list1: res.data.data.list }); } }) this .setData({ classname: '辅料库编号▼' }); } else if (detail.index === 2) { var that = this ; wx.request({ url: 'httpS://hn2.api.okayapi.com/?&service=App.Table.FreeQuery&model_name=safe2&where=[["newID","LIKE","%成品库%"]]&page=1&perpage=500&order=["newID DESC"]&app_key=88DE911C912A3CBB6279020C73DFC327&sign=DBEC0C74EA1F98C78DD15' , header: { 'content-type' : 'application/json' // 默认值 }, success: function (res) { console.log(res.data.data.list) that.setData({ list1: res.data.data.list }); } }) this .setData({ classname: '成品库编号▼' }); } else if (detail.index === 3) { this .getdata(); this .setData({ classname: '所有班组编号▼' }); } setTimeout(() => { this .setData({ [`show`]: false , [`actions[${index}].loading`]: false }); }, 1500); }, |
if语句的判断有问题吗?classname赋值均能实现
你好,建议调试一下看看:https://developers.weixin.qq.com/miniprogram/dev/api/wx.setEnableDebug.html