1+ <template >
2+ <input
3+ v-number =" config"
4+ type =" text"
5+ autocomplete =" off"
6+ :value =" maskedValue"
7+ class =" v-number"
8+ @change =" change"
9+ @input =" input"
10+ @blur =" (evt) => $emit('blur', evt)"
11+ @focus =" (evt) => $emit('focus', evt)"
12+ />
13+ </template >
14+
15+ <script lang="ts">
116import Vue from ' vue'
217import directive from ' ./directive'
318import { cloneDeep , CustomInputEvent , Input } from ' ./core'
@@ -16,7 +31,7 @@ export default Vue.extend({
1631 },
1732 nullValue: {
1833 type: [Number , String ],
19- default : ( ) => options . nullValue
34+ default: options .nullValue
2035 },
2136 masked: {
2237 type: Boolean ,
@@ -32,35 +47,35 @@ export default Vue.extend({
3247 },
3348 precision: {
3449 type: Number ,
35- default : ( ) => options . precision
50+ default: options .precision
3651 },
3752 minimumFractionDigits: {
3853 type: Number ,
39- default : ( ) => options . minimumFractionDigits
54+ default: options .minimumFractionDigits
4055 },
4156 decimal: {
4257 type: String ,
43- default : ( ) => options . decimal
58+ default: options .decimal
4459 },
4560 min: {
4661 type: Number ,
47- default : ( ) => options . min
62+ default: options .min
4863 },
4964 max: {
5065 type: Number ,
51- default : ( ) => options . max
66+ default: options .max
5267 },
5368 separator: {
5469 type: String ,
55- default : ( ) => options . separator
70+ default: options .separator
5671 },
5772 prefix: {
5873 type: String ,
59- default : ( ) => options . prefix
74+ default: options .prefix
6075 },
6176 suffix: {
6277 type: String ,
63- default : ( ) => options . suffix
78+ default: options .suffix
6479 }
6580 },
6681 data() {
@@ -98,25 +113,15 @@ export default Vue.extend({
98113 }
99114 },
100115 methods: {
101- input ( event : CustomInputEvent ) {
102- const { target } = event
116+ input(event : Event ) {
117+ const { target } = event as CustomInputEvent
103118 this .maskedValue = target .value
104119 this .unmaskedValue = target .unmaskedValue
105120 this .$emit (' input' , this .emittedValue )
106121 },
107122 change() {
108123 this .$emit (' change' , this .emittedValue )
109124 }
110- } ,
111- template : `<input
112- v-number="config"
113- type="text"
114- autocomplete="off"
115- :value="maskedValue"
116- class="v-number"
117- @change="change"
118- @input="input"
119- @blur="(evt) => $emit('blur', evt)"
120- @focus="(evt) => $emit('focus', evt)"
121- >`
125+ }
122126})
127+ </script >
0 commit comments