[system] DOMException: Failed to execute 'open' on 'XMLHttpRequest': Invalid URL 有更新! 2021-09-06 报错如图 解决 问题出现原因为某个请求缺了个“/”,所以在自己的项目中找到了缺失的地方。 1//更新学习到的红外码信息 2// /iot/tuya/oAuth/updateLearningCode报错时是iot/tuya/oAuth/updateLearningCode 3//将“/”加上即可 4function updateLearningCode(data, resultFunction, failFunction){ 5 requestUtils.doPostRequestToTuYa("/iot/tuya/oAuth/updateLearningCode", data, resultFunction, failFunction); 6}
JavaScript根据日期判断当前是周几。 2021-07-08 一、创建周一至周末数组 由于我是 uni-app 项目,所以就使用 uniapp 的格式了,js 也一样。 weekDay: ["星期天", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六"] 二、写方法返回当前星期几。传值为日期,如 2021-07-08 isWeekDay(date){ let _this = this; let myDate = new Date(Date.parse(date)); return _this.weekDay[myDate.getDay()]; },
JavaScript将字符串base64编码 2021-05-31 function base64Encode(baseSting) { var base64Chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; var length = baseSting.length; var chara1, chara2, chara3; var out = "", i = 0; while (i < length) { chara1 = baseSting.charCodeAt(i++) & 0xff; out += base64Chars.charAt(chara1 >> 2); if (i == length) { out += base64Chars.charAt((chara1 & 0x3) << 4); out += "=="; break; } chara2 = baseSting.charCodeAt(i++); if (i == length) { out += base64Chars.charAt(((....