根据状态不同来判断需要显示的数据page({ result:[], get(){ utils.askData(‘get’, url, ‘’, (res) => {//请求接口,res.data是个数组,将res.data里的数据push到result里 for (let key in res.data) { result.push(res.data[key]); //if(res.data[key].type){ //如果在这里面判断状态,在wxml里数据将不会循环 // } } //可以循环 result.forEach(function(v){//将是否显示写入result数组里 if(v.order_status==“1”) { v.cancleBtn = true;} if (v.order_status == “3”){ v.cancleBtn = false; } }, ‘’); } }); wxml: <view wx:for="{{result}}" wx:key="{{index}}"> <view wx:if="{{item.cancleBtn}}"></view> </view>