发送XMLHttpRequest请求,报错如下:
Error 3817, please go to https://github.com/cocos-creator/engine/blob/develop/EngineErrorMap.md#3817 to see details. Arguments: layout, 1
Corrupted component value: null
看起来这个报错和XMLHttpRequest没啥关系. 不清楚你是怎么使用的. 可以给个可复现的demo我吗
怎么给你demo呢
这是我完整的请求链接,我去除网络请求在原生构建的时候,就没有问题。
ajaxRequest(option) {
console.log(this.mise());
option.method = option.method ? option.method.toUpperCase() : "GET"
option.data = option.data || {}
option.type = option.type || 'json'
var formData = [];
for (const key in option.data) {
formData.push(''.concat(key, '=', option.data[key]))
}
option.data = formData.join('&')
if (option.method === 'GET' && formData.length > 0) {
option.url += location.search.length === 0 ? ''.concat('?', option.data) : ''.concat('&', option.data);
}
var a = this.mise()
option.url += "?timeStamp=" + a.timeStamp + "&randomStr=" + a.randomStr + "&signature=" + a.signature
var xhr = new XMLHttpRequest()
xhr.responseType = option.type
xhr.onreadystatechange = function () {
if (xhr.readyState === 4) {
if (xhr.status === 200) {
option.success(xhr.response)
} else {
option.error(xhr.status)
}
}
}
xhr.open(option.method, option.url, true)
if (option.method === 'POST') {
xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded')
}
console.log(option.data);
xhr.send(option.method === 'POST' ? option.data : null);
}
我私信你邮箱啦
公司是内网,没法把demo发你,不好意思呀。
我用的3.6.1的编辑器。就单纯请求一个一个GET,也会出现In the constructor of HttpClient!这个报错