1+ <template >
2+ <div class =" row q-col-gutter-lg" >
3+ <div class =" col-sm-8 col-sx-12" >
4+ <q-list class =" q-gutter-y-sm" >
5+ <div class =" column" >
6+ <div class =" text-h6" >Component</div >
7+ <q-field
8+ dense
9+ outlined
10+ >
11+ <template v-slot :control >
12+ <number
13+ class =" q-field__input"
14+ v-model =" price"
15+ v-bind =" config"
16+ />
17+ </template >
18+ </q-field >
19+ <div >Model value: <span class =" text-bold" >{{price}}</span ></div >
20+ </div >
21+ <div class =" column" >
22+ <div class =" text-h6" >Directive</div >
23+ <q-field
24+ dense
25+ outlined
26+ hint =" masking doesn't work with directive"
27+ >
28+ <template v-slot :control >
29+ <input
30+ type =" tel"
31+ class =" q-field__input"
32+ v-number =" config"
33+ v-model =" priceDirective"
34+ />
35+ </template >
36+ </q-field >
37+ <div >Model value: <span class =" text-bold" >{{priceDirective}}</span ></div >
38+ </div >
39+ <div class =" column" >
40+ <div class =" text-h6" >Directive on Custom Component of <a href =" https://quasar.dev/vue-components/input" target =" _blank" >QInput</a ></div >
41+ <q-input
42+ dense
43+ outlined
44+ v-model =" priceUnmasked"
45+ v-number =" config"
46+ />
47+ <div >Model value: <span class =" text-bold" >{{priceUnmasked}}</span ></div >
48+ </div >
49+ </q-list >
50+ </div >
51+ <div class =" col-sm-4 col-sx-12" >
52+ <q-list class =" q-gutter-y-sm" >
53+ <q-input dense v-model =" config.prefix" type =" text" label =" Prefix" />
54+ <q-input dense v-model =" config.suffix" type =" text" label =" Suffix" />
55+ <q-input dense v-model.number =" config.precision" type =" number" min =" 0" max =" 5" label =" Precision" />
56+ <q-input dense v-model =" config.decimal" type =" text" label =" Decimal" />
57+ <q-input dense v-model =" config.separator" type =" text" label =" Separator" />
58+ <q-checkbox dense v-model =" config.masked" label =" Masked" />
59+ </q-list >
60+ </div >
61+ </div >
62+ </template >
63+
64+ <script >
65+ export default {
66+ data () {
67+ return {
68+ price: 0 ,
69+ priceDirective: 5432.1 ,
70+ priceUnmasked: 6789.10 ,
71+ config: {
72+ decimal: ' .' ,
73+ separator: ' ,' ,
74+ prefix: ' $' ,
75+ suffix: ' %' ,
76+ precision: 2 ,
77+ masked: false
78+ }
79+ }
80+ },
81+ methods: {
82+ change (evt ) {
83+ console .log (' change' , evt .target .value );
84+ }
85+ }
86+ }
87+ </script >
88+
89+ <style lang="css">
90+ .container {
91+ min-width : 800px ;
92+ max-width : 95vw ;
93+ }
94+ </style >
0 commit comments