报错信息
"MiniProgramError\nundefined is not an object (evaluating 'e.substr')\nTypeError: undefined is not an object (evaluating 'e.substr')\nat getTerm (app-service.js:6296:10510)\nat solar2lunar (app-service.js:6296:12267)\nat getDayInfo (app-service.js:6308:1612)\nat getMonthData (app-service.js:6308:1392)\nat initDateTime (app-service.js:6308:686)\nat attached (app-service.js:6308:5893)\nat (WASubContext.js:1:474892)\nat (WASubContext.js:1:474673)\nat t (WASubContext.js:1:492309)\nat t (WASubContext.js:1:492621)\nat t (WASubContext.js:1:492563)\nat f (WASubContext.js:1:492631)\nat (WASubContext.js:1:504658)\nat Pa (WASubContext.js:1:674985)\nat (WASubContext.js:1:721870)\nat (WASubContext.js:1:690345)\nat (WASubContext.js:1:724155)\nat (WASubContext.js:1:690345)\nat (WASubContext.js:1:728126)\nat (WASubContext.js:1:690345)\nat vr (WASubContext.js:1:734559)\nat (WASubContext.js:1:689483)\nat (WAServiceMainContext.js:1:751648)\nat emit (WAServiceMainContext.js:1:748399)\nat emit (native code)\nat (WAServiceMainContext.js:1:2319816)\nat (WAServiceMainContext.js:1:758478)\nat (WAServiceMainContext.js:1:751747)\nat emit (WAServiceMainContext.js:1:748399)\nat (WAServiceMainContext.js:1:803801)\nat (WAServiceMainContext.js:1:781469)\nat (WAServiceMainContext.js:1:144911)\nat emit (WAServiceMainContext.js:1:81766)\nat (WAServiceMainContext.js:1:84248)\nat emit (WAServiceMainContext.js:1:81389)\nat subscribeHandler (WAServiceMainContext.js:1:83949)\nglobal code@"
实在排查不出来了,各位大佬帮忙看看!
基础库:2.25.2
苹果机版本:15
&定位到时substr的问题 难道苹果手机.substr 这个方法不管用么?
请具体描述问题出现的流程,并提供能复现问题的简单代码片段(https://developers.weixin.qq.com/miniprogram/dev/devtools/minicode.html)。
/**
* 传入公历(!)y年获得该年第n个节气的公历日期
* @param y公历年(1900-2100);n二十四节气中的第几个节气(1~24);从n=1(小寒)算起
* @return day Number
* @eg:var _24 = calendar.getTerm(1987,3) ;//_24=4;意即1987年2月4日立春
*/
getTerm: function (y, n) {
if (y <1900 || y > 2100) {
return -1;
}
if (n <1 || n > 24) {
return -1;
}
var _table = this.sTermInfo[y - 1900];
var _info = [
parseInt('0x' + _table.substr(0, 5)).toString(),
parseInt('0x' + _table.substr(5, 5)).toString(),
parseInt('0x' + _table.substr(10, 5)).toString(),
parseInt('0x' + _table.substr(15, 5)).toString(),
parseInt('0x' + _table.substr(20, 5)).toString(),
parseInt('0x' + _table.substr(25, 5)).toString()
];
var _calday = [
_info[0].substr(0, 1),
_info[0].substr(1, 2),
_info[0].substr(3, 1),
_info[0].substr(4, 2),
_info[1].substr(0, 1),
_info[1].substr(1, 2),
_info[1].substr(3, 1),
_info[1].substr(4, 2),
_info[2].substr(0, 1),
_info[2].substr(1, 2),
_info[2].substr(3, 1),
_info[2].substr(4, 2),
_info[3].substr(0, 1),
_info[3].substr(1, 2),
_info[3].substr(3, 1),
_info[3].substr(4, 2),
_info[4].substr(0, 1),
_info[4].substr(1, 2),
_info[4].substr(3, 1),
_info[4].substr(4, 2),
_info[5].substr(0, 1),
_info[5].substr(1, 2),
_info[5].substr(3, 1),
_info[5].substr(4, 2),
];
return parseInt(_calday[n - 1]);
},
https://developers.weixin.qq.com/s/ZrdQrJml79BM