小程序小坑1

1. ios 机型中 Date 小坑

将string 2020-03-22 00:00:00 转成time

new Date('2020-03-22 00:00:00').getTime() 
Date.parse('2020-03-22 00:00:00') 

均得到null;
解决方案:

var dateString = "2015-12-31 00:00:00";
var d = new Date(dateString.replace(/-/g, '/'));

这是es5时间格式等一个问题,参考格式:YYYY-MM-DDTHH:mm:ss.sssZ
https://stackoverflow.com/questions/13363673/javascript-date-is-invalid-on-ios

   Year:
      YYYY (eg 1997)
   Year and month:
      YYYY-MM (eg 1997-07)
   Complete date:
      YYYY-MM-DD (eg 1997-07-16)
   Complete date plus hours and minutes:
      YYYY-MM-DDThh:mmTZD (eg 1997-07-16T19:20+01:00)
   Complete date plus hours, minutes and seconds:
      YYYY-MM-DDThh:mm:ssTZD (eg 1997-07-16T19:20:30+01:00)
   Complete date plus hours, minutes, seconds and a decimal fraction of a
second
      YYYY-MM-DDThh:mm:ss.sTZD (eg 1997-07-16T19:20:30.45+01:00)
where:

     YYYY = four-digit year
     MM   = two-digit month (01=January, etc.)
     DD   = two-digit day of month (01 through 31)
     hh   = two digits of hour (00 through 23) (am/pm NOT allowed)
     mm   = two digits of minute (00 through 59)
     ss   = two digits of second (00 through 59)
     s    = one or more digits representing a decimal fraction of a second
     TZD  = time zone designator (Z or +hh:mm or -hh:mm)

2. 设置小程序title bar 不生效,原因是没有将页面写入appjson

{
  "pages": [
    "pages/index/index",
    "pages/xxx/xxx"
    ]
}

3. button 上样式有button: not([size='mini']) 样式:该用view实现或者 去掉app.json 中到style: v2;

你可能感兴趣的:(小程序小坑1)