How to use mask in vuetify text-field?

2019-04-21 01:31发布

I'm trying to use the mask property of text-field component, like the example below. In the view, that works like a charm, but, when the form is posted, the mask format does not keep the value.

For example, when I type "000.000.000-00", the value that the form posted was "00000000000". How can I keep the format value?

<v-text-field
  :value="currentValue" 
  @input="handleInput"
  :mask="###.###.###-##"></v-text-field>

1条回答
手持菜刀,她持情操
2楼-- · 2019-04-21 01:47

You can use return-masked-value prop

<v-text-field
    :value="currentValue" 
    return-masked-value
    mask="###.###.###-##"
    @input="handleInput"
></v-text-field>

Note that currently in v0.17 there is a bug with returning unmasked initial value.

查看更多
登录 后发表回答