v-money
v-money copied to clipboard
Placeholder option?
Is it possible to use placeholder text instead inside the input of just displaying the default model value?
+1, would love to know this as well. I have a requirement from a client where they want to not show a default value - v-money will always force a value of 0. I don't want to mask unless the user has input something.
+2000
This will be interesting for me as well, +1.
+1. I would love this option too. At the moment, showing 0.00 is confusing to my customers as they think the price is zero as opposed to been not set
+1 would love too...
You can show the input placeholder using the v-money directive instead of the component.
<input placeholder="00.00" v-model="price" v-money="price !== null ? money : null" class="form-input input-lg" />
Fiddle adapted from the read.me
: https://jsfiddle.net/fnxub0yg/1/
@yvdlima Actually I want to get unmasked value. Then I cannot use the directive. So I should use the component, but the component cannot accept null.
@kimyeongbin As a workaround you could remove the mask manually:
<input v-money="money" @change="uglyWorkaround" model="maskedValue">
methods: {
uglyWorkaround() {
this.value = parseFloat(this.maskedValue.replace(".", "").replace(",", "."));
// Do it where it makes sense for your case, not necessary on change event
}
}
@yvdlima ~~How about changing the value prop of the component to allow null ? I don't know the side effect of it, but I simply think that's the best way without doing ugly things.~~
I find this fork. I'm using the allowBlank option and it can be solved. nholden/v-money
https://github.com/vuejs-tips/v-money/pull/51 https://github.com/nholden/v-money
You can show the input placeholder using the v-money directive instead of the component.
<input placeholder="00.00" v-model="price" v-money="price !== null ? money : null" class="form-input input-lg" />
Fiddle adapted from the
read.me
: https://jsfiddle.net/fnxub0yg/1/
Thanks! It's cool!
hey, Unfortunately I don't think support will come soon. This repo seems to be abandoned! I decided to upgrade this package to be used with Vue3.
Welcome v-money3
!
I'm interested to maintain v-money3
for vue 3 and beyond. Feel free to open this same issue there if you are planning to upgrade your project.