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

Commit 3ba2dd9

Browse files
authored
Merge pull request #10 from morsaPT/master
Added: inputclass prop to specify a diferent class name for the input…
2 parents 880fc5b + bce655d commit 3ba2dd9

File tree

3 files changed

+12
-3
lines changed

3 files changed

+12
-3
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ npm install vue-input-number --save-dev
2929
:min="10"
3030
:max="100"
3131
:maxlength="3"
32+
:inputclass="'v-input-number-input'"
3233
@onInputNumberChange="onChange"></input-number>
3334

3435
</template>
@@ -68,6 +69,7 @@ For more detailed example check out [the app directory](./app).
6869
- __mousedown:__ Enable mousedown for increment or decrement value.
6970
- __integer:__ Enable integer value only.
7071
- __placeholder:__ Set a input placeholder. If `placeholder` has some value then `min` is not used as a placeholder.
72+
- __inputclass:__ Set a diferent class for the input element. For example, if you use Bootstrap default input class you can set `:inputclass="'form-control'"` to use `form-control` class in the input element.
7173

7274
## Events
7375

app/app.vue

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
:max="options.max"
1919
:maxlength="options.maxlength"
2020
:placeholder="options.placeholder"
21+
:class="options.inputclass"
2122
@onInputNumberChange="inputChange"></input-number>
2223
</p>
2324

@@ -35,7 +36,8 @@ interface Options {
3536
min: number,
3637
max: number,
3738
maxlength: number,
38-
placeholder: String
39+
placeholder: String,
40+
inputclass: String
3941
}
4042
4143
@Component
@@ -45,7 +47,8 @@ export default class App extends Vue {
4547
min: 1,
4648
max: 100,
4749
maxlength: 3,
48-
placeholder: 'Enter a number'
50+
placeholder: 'Enter a number',
51+
inputclass: 'v-input-number-input'
4952
}
5053
5154
inputValue: number = 1

index.vue

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
:maxlength="maxlength"
1919
autocomplete="off"
2020
:placeholder="placeholder"
21-
class="v-input-number-input"
21+
:class="inputclass"
2222
v-model.number="quantity"
2323
@keyup="onKeyup($event)"
2424
@keydown="onKeydown($event)"
@@ -65,6 +65,10 @@ export default {
6565
placeholder: {
6666
type: String,
6767
default: ''
68+
},
69+
inputclass: {
70+
type: String,
71+
default: 'v-input-number-input'
6872
}
6973
},
7074

0 commit comments

Comments
 (0)