vue-count-button
A simple vue component that count the clicking times
Try online demo here: demonstration
Installation
via npm
npm install vue-count-button --save
Import
ES2015
;
CommonJS
var VueCountButton = ;
script
Basic Usage
new Vue({ el: 'body', components: { 'vue-count-button': VueCountButton }, methods: { onChange: function(e){ console.log(e); //e is current counter value } }});
Props
Name | Type | Required | Description | Example |
---|---|---|---|---|
init | number | No | The initial value of the counter. 0 by default |
5 |
txt | string | No | The text displayed in center of the counter. OK by default |
'Push' |
width | number | No | The width of the counter. 50 by default |
70 |
bgColor | string | No | The ``background-color of the counter. #464646 by default |
green |
Events
Name | Type | Required | Description |
---|---|---|---|
counter-updated | in -> out | No | Get notified while counter is updated. |
counter-reset | out -> in | No | Notify the counter to be reset. |
Examples
Event - counter-updated
... components: 'vue-count-button': VueCountButton methods: { console; //e is current counter value } ;
Event - counter-reset
... components: 'vue-count-button': VueCountButton { ; };