about the use of wepy intercept interceptor
according to the official instructions, the interceptor was added, but there was no response. I don"t know why I hope the god will give me some advice. Thank you, little brother.
related codes
/ / app.wy Code
constructor () {
super()
this.use("promisify")
this.use("requestfix")
this.intercept("request", {
//
config (p) {
// requestOBJECT
p.timestamps = +new Date();
console.log("config request: ", p);
// OBJECT
return p;
},
//
success (p) {
//
console.log("request success: ", p);
//
return p;
},
//
fail (p) {
console.log("request fail: ", p);
//
return p;
},
// ()
complete (p) {
console.log("request complete: ", p);
}
});
Request initiated by }
page
request () {
let self = this
let i = 10
let map = ["MA==", "MQo=", "Mg==", "Mw==", "NA==", "NQ==", "Ng==", "Nw==", "OA==", "OQ=="]
while (i--) {
wx.request({
url: "https://www.madcoder.cn/tests/sleep.php?time=1&t=css&c=" + map[i] + "&i=" + i,
success: function (d) {
self.netrst += d.data + "."
self.$apply()
}
})
}
}