Skip to content

Commit

Permalink
Close #13: Let developer provide custom icons
Browse files Browse the repository at this point in the history
  • Loading branch information
darrenfang committed Dec 26, 2018
1 parent 9602cd6 commit 6825df7
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 2 deletions.
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,3 +53,11 @@ Once installed, it can be used in a template as simply as:
| Name | Arguments | Description |
| -----------| -----------------------| ------------------------ |
| input | value (Date/String) | The updated bound model |

## Slots

| Name | Description |
| -----------| ----------------------------------------- |
| dateIcon | Slot to put custom icon in the date tab. |
| timeIcon | Slot to put custom icon in the time tab. |
| actions | Slot to put custom buttons in the dialog. |
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
"url": "git+https://github.com/darrenfang/vuetify-datetime-picker"
},
"devDependencies": {
"@fortawesome/fontawesome-free": "^5.6.3",
"babel-core": "^6.24.1",
"babel-loader": "^7.0.0",
"babel-preset-es2015": "^6.24.1",
Expand Down
14 changes: 14 additions & 0 deletions src/app.vue
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,26 @@
</v-datetime-picker>
</v-flex>
</v-layout>
<v-layout row justify-center>
<v-flex xs4>
<span class="subheading">Custom Icons</span>
<v-datetime-picker v-model="datetime">
<template slot="dateIcon">
<v-icon>fas fa-calendar</v-icon>
</template>
<template slot="timeIcon">
<v-icon>fas fa-clock</v-icon>
</template>
</v-datetime-picker>
</v-flex>
</v-layout>
</v-container>
</v-app>
</template>

<script>
import moment from 'moment'
import '@fortawesome/fontawesome-free/css/all.css'
export default {
data () {
Expand Down
8 changes: 6 additions & 2 deletions src/components/DatetimePicker.vue
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,14 @@
<v-card-text style="padding: 0;">
<v-tabs fixed-tabs v-model="activeTab">
<v-tab key="calendar">
<v-icon>event</v-icon>
<slot name="dateIcon">
<v-icon>event</v-icon>
</slot>
</v-tab>
<v-tab key="timer" :disabled="!dateSelected">
<v-icon>access_time</v-icon>
<slot name="timeIcon">
<v-icon>access_time</v-icon>
</slot>
</v-tab>
<v-tab-item key="calendar">
<v-date-picker
Expand Down

0 comments on commit 6825df7

Please sign in to comment.