Skip to content
This repository was archived by the owner on Jul 25, 2022. It is now read-only.

Commit 87472aa

Browse files
authored
Merge pull request #9 from baronkoko/defaultvalue
add default value prop closes #7, #8
2 parents 97b8fa2 + 50c3169 commit 87472aa

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
node_modules
22
dist
33
*.log
4+
.idea

index.vue

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,10 @@
3030
<script>
3131
export default {
3232
props: {
33+
value: {
34+
type: Number,
35+
default: 0
36+
},
3337
min: {
3438
type: Number,
3539
default: 0
@@ -105,7 +109,7 @@ export default {
105109
this.oldValue = this.quantity
106110
107111
if (init && !this.placeholder) {
108-
this.quantity = this.min
112+
this.quantity = (this.value < this.min) ? this.min : this.value
109113
}
110114
111115
this.$emit('onInputNumberChange', this.quantity, init)

0 commit comments

Comments
 (0)