formatter.vue 356 B

1234567891011121314
  1. <template>
  2. <kk-input
  3. v-model="input"
  4. placeholder="Please input"
  5. :formatter="(value) => `$ ${value}`.replace(/\B(?=(\d{3})+(?!\d))/g, ',')"
  6. :parser="(value) => value.replace(/\$\s?|(,*)/g, '')"
  7. />
  8. </template>
  9. <script lang="ts" setup>
  10. import { ref } from 'vue'
  11. import { KkInput } from 'kankan-components'
  12. const input = ref('')
  13. </script>