有没有编辑和添加的js代码啊?
有没有编辑和添加的js代码啊?
有没有编辑和添加的js代码啊?
2018-10-14
有呀,添加的事件和置空的事件
formSubmit:function(e) {
var that = this;
var formData = e.detail.value;
var url = that.data.addUrl;
if(that.data.areaId!=undefined) {
formData.areaId=that.data.areaId;
url=that.data.modifyUrl;
}
wx.request({
url: url,
data:JSON.stringify(formData),
method:'POST',
header:{
'Content-Type':'application/json'
},
success:function(res) {
var result = res.data.success
var toastText = "操作成功";
if(result!=true) {
toastText = "操作失败"+res.data.errMsg;
}
wx.showToast({
title: toastText,
icon:'',
duration:2000
});
if(that.data.areaId == undefined) {
wx.redirectTo({
url: '../list/list',
})
}
}
});
},
reset:function(res) {
that.setData({
areaId:'',
priority:''
});
}
举报