|
1 | 1 | # vue-count-down-timer
|
2 |
| - |
3 |
| -## Project setup |
| 2 | +This is a count down timer for Vue js framework. This library supports two types of timers: |
| 3 | +1. Timer mode: Timer based on hour, minute and second. |
| 4 | +2. Single mode: Timber based on second (single circle without hours and minutes). |
| 5 | +## Installation |
4 | 6 | ```
|
5 |
| -npm install |
| 7 | +npm install vue-circular-count-down-timer |
6 | 8 | ```
|
7 |
| - |
8 |
| -### Compiles and hot-reloads for development |
| 9 | +After installation, import component: |
9 | 10 | ```
|
10 |
| -npm run serve |
| 11 | +import CircularCountDownTimer from "vue-circular-count-down-timer"; |
11 | 12 | ```
|
12 | 13 |
|
13 |
| -### Compiles and minifies for production |
| 14 | +###Documentation |
| 15 | +| Props | Description | |
| 16 | +| --- | --- | |
| 17 | +| initial_value | Initial value of timer, as seconds. (required) | |
| 18 | +| stroke-width | Thickness of circle strokes in px. | |
| 19 | +| seconds-stroke-color | Color of stroke of seconds circle. | |
| 20 | +| minutes-stroke-color | Color of stroke of minutes circle. | |
| 21 | +| hours-stroke-color | Color of stroke of hours circle. | |
| 22 | +| underneath-stroke-color | Color of stroke of empty parts of circles. | |
| 23 | +| seconds-fill-color | Color of background of seconds circle. | |
| 24 | +| minutes-fill-color | Color of background of minutes circle. | |
| 25 | +| hours-fill-color | Color of background of hours circle. | |
| 26 | +| size | Width and height of circles in px. | |
| 27 | +| padding | Space between circles in px. | |
| 28 | +| hour-label | Label of hours circle. | |
| 29 | +| minute-label | Label of minutes circle. | |
| 30 | +| second-label | Label of seconds circle. | |
| 31 | +| show-second | Whether to show seconds circle or not. | |
| 32 | +| show-minute | Whether to show minutes circle or not. | |
| 33 | +| show-hour | Whether to show hours circle or not. | |
| 34 | +| show-negatives | To continue counting after reaching zero. | |
| 35 | +| steps | Number of steps in single mode usage. | |
| 36 | +| paused | To pause counting. | |
| 37 | + |
| 38 | +| Events | Description | |
| 39 | +| --- | --- | |
| 40 | +| finish | Fires when counter reach zero. | |
| 41 | +| update | Fires on each counting. | |
| 42 | + |
| 43 | +### Usage |
| 44 | +####1. basic timer |
14 | 45 | ```
|
15 |
| -npm run build |
| 46 | +<CircularCountDownTimer |
| 47 | + :initial-value="360500" |
| 48 | +></CircularCountDownTimer> |
16 | 49 | ```
|
17 | 50 |
|
18 |
| -### Run your tests |
| 51 | +####2. Fully customized (timer mode) |
19 | 52 | ```
|
20 |
| -npm run test |
| 53 | +<CircularCountDownTimer |
| 54 | + :initial-value="360500" |
| 55 | + :stroke-width="5" |
| 56 | + :seconds-stroke-color="'#f00'" |
| 57 | + :minutes-stroke-color="'#0ff'" |
| 58 | + :hours-stroke-color="'#0f0'" |
| 59 | + :underneath-stroke-color="'lightgrey'" |
| 60 | + :seconds-fill-color="'#00ffff66'" |
| 61 | + :minutes-fill-color="'#00ff0066'" |
| 62 | + :hours-fill-color="'#ff000066'" |
| 63 | + :size="200" |
| 64 | + :padding="4" |
| 65 | + :hour-label="'hours'" |
| 66 | + :minute-label="'minutes'" |
| 67 | + :second-label="'seconds'" |
| 68 | + :show-second="true" |
| 69 | + :show-minute="true" |
| 70 | + :show-hour="true" |
| 71 | + :show-negatives="true" |
| 72 | + :paused="some_variable" |
| 73 | +></CircularCountDownTimer> |
21 | 74 | ```
|
22 | 75 |
|
23 |
| -### Lints and fixes files |
| 76 | + |
| 77 | + |
| 78 | +####3. Single mode |
24 | 79 | ```
|
25 |
| -npm run lint |
| 80 | +<CircularCountDownTimer |
| 81 | + :initial-value="200" |
| 82 | + :steps="400" |
| 83 | +></CircularCountDownTimer> |
26 | 84 | ```
|
27 | 85 |
|
28 |
| -### Customize configuration |
29 |
| -See [Configuration Reference](https://cli.vuejs.org/config/). |
| 86 | + |
| 87 | + |
| 88 | + |
| 89 | +####4. Listen to events |
| 90 | +```` |
| 91 | +<CircularCountDownTimer |
| 92 | + :initial-value="200" |
| 93 | + @finish="finished" |
| 94 | + @update="updated" |
| 95 | +></CircularCountDownTimer> |
| 96 | +
|
| 97 | +... |
| 98 | +
|
| 99 | +methods: { |
| 100 | + finished: () => { |
| 101 | + console.log('finished'); |
| 102 | + }, |
| 103 | + updated: (status) => { |
| 104 | + console.log(status); //{"value": 144, "seconds": 24, "minutes": 2, "hours": 0} |
| 105 | + } |
| 106 | +} |
| 107 | +```` |
0 commit comments