|
1 | 1 | # vue-datetime-picker
|
2 |
| -A Vue.js component implementing the date time picker using the bootstrap date time picker plugin. |
| 2 | + |
| 3 | +[](https://circleci.com/gh/Haixing-Hu/vue-datetime-picker/tree/master) |
| 4 | +[](https://coveralls.io/github/Haixing-Hu/vue-datetime-picker?branch=master) |
| 5 | +[](https://www.bithound.io/github/Haixing-Hu/vue-datetime-picker) |
| 6 | +[](https://david-dm.org/Haixing-Hu/vue-datetime-picker) |
| 7 | +[](https://david-dm.org/Haixing-Hu/vue-datetime-picker#info=devDependencies) |
| 8 | + |
| 9 | +A Vue.js component implementing the datetime picker control using the [Eonasdan's bootstrap datetime picker plugin](https://github.com/Eonasdan/bootstrap-datetimepicker). |
| 10 | + |
| 11 | +# Demo |
| 12 | + |
| 13 | +The demo page is [HERE](http://haixing-hu.github.io/vue-datetime-picker/demo.html). |
| 14 | + |
| 15 | + |
| 16 | + |
| 17 | +# Requirements |
| 18 | + |
| 19 | +- [Vue.js](https://github.com/yyx990803/vue) `^0.12.0` |
| 20 | +- [Eonasdan's bootstrap datetime picker plugin](https://github.com/Eonasdan/bootstrap-datetimepicker) `^4.17.37` |
| 21 | + |
| 22 | +# Instllation |
| 23 | + |
| 24 | +## npm |
| 25 | + |
| 26 | +```shell |
| 27 | +$ npm install vue-datetime-picker |
| 28 | +``` |
| 29 | + |
| 30 | +## bower |
| 31 | + |
| 32 | +```shell |
| 33 | +$ bower install vue-datetime-picker |
| 34 | +``` |
| 35 | + |
| 36 | +# Usage |
| 37 | + |
| 38 | +The HTML snippets are as follows: |
| 39 | + |
| 40 | +```html |
| 41 | +<div class="container" id="app"> |
| 42 | + <vue-datetime-picker model="{{@ text}}"></vue-datetime-picker> |
| 43 | + <div style="margin-top:40px"> |
| 44 | + <div> The HTML contents are as follows:</div> |
| 45 | + <hr> |
| 46 | + <div >{{{text}}}</div> |
| 47 | + </div> |
| 48 | +</div> |
| 49 | +``` |
| 50 | + |
| 51 | +The Javascript snippets are as follows: |
| 52 | + |
| 53 | +```javascript |
| 54 | +var Vue = require("vue"); |
| 55 | + |
| 56 | +var vm = new Vue({ |
| 57 | + el: "#app", |
| 58 | + components: { |
| 59 | + "vue-datetime-picker": require("vue-datetime-picker") |
| 60 | + }, |
| 61 | + data: { |
| 62 | + text: "Hello World!" |
| 63 | + } |
| 64 | +}); |
| 65 | +``` |
| 66 | + |
| 67 | +# Component Properties |
| 68 | + |
| 69 | +## `model` |
| 70 | + |
| 71 | +The model bind to the control, which must be a two way binding variable. |
| 72 | + |
| 73 | +## `language` |
| 74 | + |
| 75 | +The optional code of language used by the summernote plugin. Default value is `'en-US'`. |
| 76 | +Note that the language code passed to this property must be a language code together |
| 77 | +with a country code. This limitation is due to names of the i18n localizaiton files |
| 78 | +of the summernote plugin. |
| 79 | + |
| 80 | +# API |
| 81 | + |
| 82 | +## `control` |
| 83 | + |
| 84 | +This property is a reference to the JQuery selection of the base texearea |
| 85 | +control. It could be used to call the APIs of summernote. For example, |
| 86 | +`editor.control.code(val)` will set the HTML content of the editor to the |
| 87 | +specified value, where `editor` is the reference to the `vue-datetime-picker` |
| 88 | +component. |
| 89 | + |
| 90 | +# Contributing |
| 91 | + |
| 92 | +- Fork it ! |
| 93 | +- Create your top branch from `dev`: `git branch my-new-topic origin/dev` |
| 94 | +- Commit your changes: `git commit -am 'Add some topic'` |
| 95 | +- Push to the branch: `git push origin my-new-topic` |
| 96 | +- Submit a pull request to `dev` branch of `Haixing-Hu/vue-datetime-picker` repository ! |
| 97 | + |
| 98 | +# Building and Testing |
| 99 | + |
| 100 | +First you should install all depended NPM packages. The NPM packages are used |
| 101 | +for building and testing this package. |
| 102 | + |
| 103 | +```shell |
| 104 | +$ npm install |
| 105 | +``` |
| 106 | + |
| 107 | +Then install all depended bower packages. The bower packages are depended by |
| 108 | +this packages. |
| 109 | + |
| 110 | +```shell |
| 111 | +$ bower install |
| 112 | +``` |
| 113 | + |
| 114 | +Now you can build the project. |
| 115 | +```shell |
| 116 | +$ gulp build |
| 117 | +``` |
| 118 | + |
| 119 | +The following command will test the project. |
| 120 | +```shell |
| 121 | +$ gulp test |
| 122 | +``` |
| 123 | + |
| 124 | +The following command will perform the test and generate a coverage report. |
| 125 | +```shell |
| 126 | +$ gulp test:coverage |
| 127 | +``` |
| 128 | + |
| 129 | +The following command will perform the test, generate a coverage report, and |
| 130 | +upload the coverage report to [coveralls.io](https://coveralls.io/). |
| 131 | +```shell |
| 132 | +$ gulp test:coveralls |
| 133 | +``` |
| 134 | + |
| 135 | +You can also run `bower install` and `gulp build` together with the following |
| 136 | +command: |
| 137 | +```shell |
| 138 | +npm build |
| 139 | +``` |
| 140 | + |
| 141 | +Or run `bower install` and `gulp test:coveralls` together with the following |
| 142 | +command: |
| 143 | +```shell |
| 144 | +npm test |
| 145 | +``` |
| 146 | + |
| 147 | +# License |
| 148 | + |
| 149 | +[The MIT License](http://opensource.org/licenses/MIT) |
0 commit comments