Skip to content

Commit d400080

Browse files
committed
Update README to match Demo, improve props/events docs
1 parent b39f257 commit d400080

File tree

1 file changed

+11
-9
lines changed

1 file changed

+11
-9
lines changed

README.md

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@ export default {
2727
```html
2828
<template>
2929
<VueSelectQuantity
30-
data-id="id"
31-
v-model="quantity"
30+
:value="quantity"
31+
data-id="vsq-1"
3232
@update:quantity="update($event)"
3333
@remove:quantity="remove($event)"
3434
/>
@@ -40,17 +40,19 @@ export default {
4040
export default {
4141
data () {
4242
return {
43-
id: '1',
4443
quantity: 1
4544
}
4645
},
4746
methods: {
4847
update (evt) {
49-
console.log('received update:quantity event', evt)
50-
this.quantity = evt
48+
const { id, qty } = evt
49+
if (qty) {
50+
this.quantity = qty
51+
}
52+
console.log(`update event received for id ${id} with quantity ${this.quantity}`
5153
},
52-
remove (evt) {
53-
console.log('received remove:quantity event', evt)
54+
remove (id) {
55+
console.log(`remove event received for id ${id}`)
5456
}
5557
}
5658
}
@@ -61,14 +63,14 @@ export default {
6163
6264
| Property name | Type | Default | Description |
6365
| ------------- | ---- | ------- | ----------- |
64-
| data-id | String | null | A required property to identify the component instance |
6566
| v-model | Number | null | A required property which represents the quantity to be updated |
67+
| data-id | String | null | A data property to identify the component instance |
6668
6769
## Events
6870
6971
| Event name | Trigger |
7072
| ------------- | ---- |
71-
| update:quantity | Called when the quantity is changed (e.g., 1-9 is selected from the menu, Update button is clicked) |
73+
| update:quantity | Called when the quantity is changed (e.g., 1-9 is selected from the menu, Update button is clicked). Event object sent includes `id` and `qty` properties.|
7274
| remove:quantity | Called when the 0 is selected from the menu) |
7375
7476
## Developers

0 commit comments

Comments
 (0)