Skip to content

Commit 70ea29b

Browse files
committed
updated docs to add Datepicker
1 parent 28a1ba0 commit 70ea29b

File tree

1 file changed

+35
-2
lines changed

1 file changed

+35
-2
lines changed

README.md

Lines changed: 35 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -141,14 +141,47 @@ These should be added to the `templateOptions` property. Some input types may ha
141141
* textarea
142142
* list ( radio/checkbox )
143143

144+
###Datepickers & Select2 style selects
145+
Given that there are so many different datepickers and select boxes out there I've decided not to implement one natively. This is a) to reduce bloat and b) so that you can implement whichever one you want. When you do want to add one, simply [create your own Formly Field](https://matt-sanders.gitbooks.io/vue-formly/content/v/2.0/how_to_use/creating_formly_fields.html).
146+
147+
To help you out a bit, here is an example of how you would go about doing this using [vuejs datepicker](https://github.com/charliekassel/vuejs-datepicker)
148+
149+
```js
150+
//main.js
151+
...
152+
import datepicker from './components/datepicker.vue';
153+
vueFormly.addType('datepicker', datepicker);
154+
```
155+
156+
```js
157+
//datepicker.vue
158+
<template>
159+
<div class="form-group formly-datepicker" :class="[ to.inputType, {'formly-has-value': model[field.key], 'formly-has-focus': form[field.key].$active, 'has-error': hasError}]">
160+
<datepicker v-model="model[field.key]"></datepicker>
161+
<error-display :form="form" :field="field.key"></error-display>
162+
</div>
163+
</template>
164+
165+
<script>
166+
import baseField from 'vue-formly-bootstrap/src/fields/baseField';
167+
import datepicker from 'vuejs-datepicker';
168+
export default {
169+
mixins: [baseField],
170+
components: {
171+
datepicker
172+
}
173+
}
174+
</script>
175+
```
176+
144177
##To Do
145178
* [x] Input
146179
* [x] Select
147180
* [x] Text Area
148181
* [x] Checkbox
149182
* [x] Radio Buttons
150-
* [ ] Date Picker
151-
* [ ] Other funky form inputs
183+
* [x] Date Picker
184+
* [x] Other funky form inputs
152185
* [x] Dirty/Clean checking
153186
* [ ] Hide/Show options
154187
* [x] Custom attributes

0 commit comments

Comments
 (0)