|
@@ -303,7 +303,15 @@
|
|
|
}
|
|
|
}
|
|
|
},
|
|
|
- methods: {
|
|
|
+ methods: {
|
|
|
+ newDate (date) {
|
|
|
+ var time=null;
|
|
|
+ if (date) {
|
|
|
+ var reg=new RegExp('-','gi')
|
|
|
+ time=new Date(date.replace(reg,'/'));
|
|
|
+ }
|
|
|
+ return time
|
|
|
+ },
|
|
|
// 标识滑动开始,只有微信小程序才有这样的事件
|
|
|
pickstart() {
|
|
|
// #ifdef MP-WEIXIN
|
|
@@ -345,10 +353,15 @@
|
|
|
//日期时间处理
|
|
|
initTimeValue() {
|
|
|
// 格式化时间,在IE浏览器(uni不存在此情况),无法识别日期间的"-"间隔符号
|
|
|
- let fdate = this.defaultTime.replace(/\-/g, '/');
|
|
|
+ let fdate = this.defaultTime.replace(/\-/g, '/');
|
|
|
+
|
|
|
fdate = fdate && fdate.indexOf('/') == -1 ? `2020/01/01 ${fdate}` : fdate;
|
|
|
+ if(fdate.length==7){
|
|
|
+ fdate+="/01"
|
|
|
+ }
|
|
|
+
|
|
|
let time = null;
|
|
|
- if (fdate) time = new Date(fdate);
|
|
|
+ if (fdate) time = this.newDate(fdate);
|
|
|
else time = new Date();
|
|
|
// 获取年日月时分秒
|
|
|
this.year = time.getFullYear();
|