Showing
1 changed file
with
9 additions
and
9 deletions
| 1 | //获取当前时间 | 1 | //获取当前时间 |
| 2 | const date=new Date(); | 2 | const date=new Date(); |
| 3 | import App from '../../../utils/api'; | 3 | import App from '../../../utils/api'; |
| 4 | +import util from '../../../utils/util'; | ||
| 4 | Component({ | 5 | Component({ |
| 5 | properties:{ | 6 | properties:{ |
| 6 | seller:Object, | 7 | seller:Object, |
| @@ -12,24 +13,23 @@ Component({ | @@ -12,24 +13,23 @@ Component({ | ||
| 12 | //日期 | 13 | //日期 |
| 13 | date:{ | 14 | date:{ |
| 14 | type:String, | 15 | type:String, |
| 15 | - value:'' | 16 | + value:util.unixtoTime(date/1000,'YYYY-MM-DD') |
| 16 | } | 17 | } |
| 17 | }, | 18 | }, |
| 18 | attached(){ | 19 | attached(){ |
| 19 | 20 | ||
| 20 | }, | 21 | }, |
| 21 | ready(){ | 22 | ready(){ |
| 22 | - //设置默认日期 | ||
| 23 | - if(this.data.date==''){ | ||
| 24 | - let currentmonth=date.getMonth()+1; | ||
| 25 | - let currentdate=date.getDate(); | ||
| 26 | - this.setData({ | ||
| 27 | - date:date.getFullYear()+'-'+(currentmonth<10 ? '0'+currentmonth : currentmonth)+'-'+(currentdate<10 ? '0'+currentdate : currentdate) | ||
| 28 | - }) | ||
| 29 | - } | ||
| 30 | this.getroombydate(); | 23 | this.getroombydate(); |
| 31 | this.triggerEvent('selecttime',{time:this.data.time,action:'defalut'}) | 24 | this.triggerEvent('selecttime',{time:this.data.time,action:'defalut'}) |
| 32 | }, | 25 | }, |
| 26 | + observers: { | ||
| 27 | + 'date': function(date) { | ||
| 28 | + this.setData({ | ||
| 29 | + date: date | ||
| 30 | + }) | ||
| 31 | + } | ||
| 32 | + }, | ||
| 33 | methods:{ | 33 | methods:{ |
| 34 | selecttime(e){ | 34 | selecttime(e){ |
| 35 | const target=e.currentTarget.dataset; | 35 | const target=e.currentTarget.dataset; |
-
Please register or login to post a comment