或关系还要打个括号,不然或关系不成立,并且javascripts还不知道认真报错
success: function (res) {
if (res.statusCode == ('201'||'200')) {
console.log(res.data)
}
else {
console.log('返回值但是报错,可能方法错了', res)
}
}
代码
好想使用正则表达式,排序算法很可爱,js也可以调包吗?
onPullDownRefresh: function () {
let pd_data = this.data.pd;
for (let detail of pd_data) {
let re_data = detail.prompt.replace('[(', '').replace(')]', '').replace('[', '').replace(']', '')
if(detail.selectType=='picker'){
detail.prompt = re_data.split(',');
detail.picker_selected='True';
}
else if (detail.selectType == 'text'){
detail.text_selected = 'True';
}
else if (detail.selectType == 'textarea'){
detail.textarea_selected = 'True';
}
else{
if (detail.selectType == 'radio'){
detail.radio_selected = 'True';
}
else if (detail.selectType == 'checkbox'){
detail.checkbox_selected = 'True';
}
let process_data = re_data.split('), (');
for(var i=0;i<process_data.length;i++){
process_data[i]=process_data[i].split(',');
if(process_data[i].length==3){
process_data[i] = {
name: process_data[i][0],
value: process_data[i][1],
checked: process_data[i][2],
}
}else{
process_data[i] = {
name: process_data[i][0],
value: process_data[i][1],
}
}
};
detail.prompt = process_data;
}
detail.order=parseInt(detail.order)
}
pd_data=pd_data.sort(function(a,b){
return a.order-b.order;
})
console.log(pd_data);
}