Commit 9e4b6e8ec346c65cb14023d5290f7f93d1b63359

Authored by 梁灏
1 parent 75ef8633

Time support String

Showing 2 changed files with 4 additions and 2 deletions   Show diff stats
examples/routers/time.vue
... ... @@ -4,7 +4,7 @@
4 4 <Time :time="1652839997" />
5 5 <Time :time="ddd" :interval="1" />
6 6  
7   -
  7 + <Time time="2018-06-20T13:09:14.000Z" />
8 8 </div>
9 9 </template>
10 10 <script>
... ...
src/components/time/time.vue
... ... @@ -13,7 +13,7 @@
13 13 name: 'Time',
14 14 props: {
15 15 time: {
16   - type: [Number, Date],
  16 + type: [Number, Date, String],
17 17 required: true
18 18 },
19 19 type: {
... ... @@ -60,6 +60,8 @@
60 60 time = (new Date(timestamp)).getTime();
61 61 } else if (type === 'object') {
62 62 time = this.time.getTime();
  63 + } else if (type === 'string') {
  64 + time = (new Date(this.time)).getTime();
63 65 }
64 66  
65 67 if (this.type === 'relative') {
... ...