File tree Expand file tree Collapse file tree 2 files changed +11
-28
lines changed Expand file tree Collapse file tree 2 files changed +11
-28
lines changed Original file line number Diff line number Diff line change 11{
22 "name" : " vue-numeric" ,
3- "version" : " 1.4.2 " ,
3+ "version" : " 1.5.0 " ,
44 "description" : " Input field component to display currency value based on Vue." ,
55 "author" : " Kevin Ongko" ,
66 "main" : " src/vue-numeric.vue" ,
Original file line number Diff line number Diff line change @@ -27,14 +27,6 @@ export default {
2727 type: String
2828 },
2929
30- /**
31- * Default value.
32- */
33- default: {
34- required: false ,
35- type: [Number , String ]
36- },
37-
3830 /**
3931 * Maximum value allowed.
4032 */
@@ -110,15 +102,6 @@ export default {
110102 return this .formatToNumber (this .amount )
111103 },
112104
113- /**
114- * Number formatted default value.
115- * @return {Number}
116- */
117- defaultValue () {
118- if (this .default ) return this .formatToNumber (this .default )
119- return 0
120- },
121-
122105 /**
123106 * Number formatted minimum value.
124107 * @return {Number}
@@ -250,18 +233,18 @@ export default {
250233 }
251234 },
252235
253- watch: {
254- ' default' (val, old) {
255- this .processValue (this .defaultValue )
256- this .formatValue (this .defaultValue )
257- }
258- },
259-
260236 mounted () {
261- if (this .defaultValue ) {
262- this .processValue (this .defaultValue )
263- this .formatValue (this .defaultValue )
237+ // Check default value from parent v-model.
238+ if (this .value ) {
239+ this .processValue (this .value )
240+ this .formatValue (this .value )
264241 }
242+
243+ // In case of delayed v-model new value.
244+ setTimeout (() => {
245+ this .processValue (this .value )
246+ this .formatValue (this .value )
247+ }, 500 )
265248 }
266249}
267250 </script >
You can’t perform that action at this time.
0 commit comments