The Axios request interface is used in the uniapp, and the mock interface is used to obtain data
Error in running wechat applet: index.js?[sm]:33 errortypeerror: l is not a function
Original writing method (not effective in wechat applet)
import axios from 'axios';
let _url = ' https://mobile-ms.uat.homecreditcfc.cn/mock/xxxxxxx/demo';
axios.get(_url + '/demoInformation').then((res) => {
console.log(res);
console.log(res.data);
console.log(res.data.data.demoData);
this.invoicesData = res.data.data.demoData;
}).catch(function (error) {
// Handling error situations
console.log(error);
});
Solution: use the native request Uni. Request()
// Default Method
uni.request({
url: 'https://www.example.com/request',
success: (res) => {
console.log(res.data);
},
fail:(err) => {
console.error(err)
}
});
Similar Posts:
- How to Solve Request failed with status code 404
- [Solved] Vue Axios error: TypeError: Cannot set property ‘tableData‘ of undefined
- [Solved] Axios Cross-domain issues: No ‘Access-Control-Allow-Origin‘ header is present on the requested resource.
- Axios gets the upload progress error: xhr.upload.addEventListener is not a function
- Solution to cross origin read blocking (CORB) blocked cross origin response error
- Axios encapsulate error: cyclic dependency [How to Solve]
- Applet error: XXX is not defined (How to Solve)
- [Vue warn]:Error in render: “TypeError: Cannot read property ‘0’ of undefined”
- Using Vue + Axios: axios.post error: request failed with status code 400 is one of the solutions