Commit 57b12e2 1 parent bb5df64 commit 57b12e2 Copy full SHA for 57b12e2
File tree 1 file changed +23
-5
lines changed
1 file changed +23
-5
lines changed Original file line number Diff line number Diff line change @@ -5,7 +5,7 @@ const props = defineProps<{
5
5
id? : string ;
6
6
placeholder: string ;
7
7
8
- modelValue? : string | null ;
8
+ modelValue? : string | number | null ;
9
9
inputClass? : string ;
10
10
labelClass? : string ;
11
11
typeOverride? : string ;
@@ -16,13 +16,31 @@ const props = defineProps<{
16
16
}>();
17
17
18
18
const model = useVModel (props , ' modelValue' );
19
+ const localModel = ref <string >();
20
+
21
+ watch (localModel , (v ) => {
22
+ if (! v ) return ;
23
+ if (props .typeOverride && props .typeOverride === ' number' ) {
24
+ model .value = parseFloat (v );
25
+ } else {
26
+ model .value = v ;
27
+ }
28
+ });
19
29
</script >
20
30
21
31
<template >
22
- <fieldset >
23
- <InputLabel :label-class :label :error :id :sublabel />
24
- <input class =" input-css" :type =" typeOverride || 'text'" :class =" inputClass" v-model =" model" :placeholder :id />
25
- </fieldset >
32
+ <InputLabel :label-class :label :error :id :sublabel >
33
+ <template #input >
34
+ <input
35
+ class =" input-css"
36
+ :type =" typeOverride || 'text'"
37
+ :class =" inputClass"
38
+ v-model =" localModel"
39
+ :placeholder
40
+ :id
41
+ />
42
+ </template >
43
+ </InputLabel >
26
44
</template >
27
45
28
46
<style scoped>
You can’t perform that action at this time.
0 commit comments