-
-
Notifications
You must be signed in to change notification settings - Fork 68
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Compatibility with Vue 3 #166
Comments
Hi @maxmaccari, thank you for summing up 👍 I have also followed the progress of Vue 3 with great interest and just want to let everyone know that I'm currently working on a compatible version. A beta version will be released shortly. |
I just published a pre-release 2.0.0-beta.0 compatible with Vue 3 🎉 Any feedback is appreciated. |
Another pre-release 2.0.0-beta.1 is available for testing. |
Another pre-release 2.0.0-beta.2 is available for testing. |
I noticed if the v-model has a value, when the page loads the
|
@Sun3: I can not reproduce your issue. This Vue 3 example works as expected: https://codesandbox.io/s/vue-currency-input-vue-3-example-5l51f |
I think I know what might be happening. When you set the original value (in my case is 0) and once the data is received from the server, the currency control is not updated with the new value. I added the
and the original value of I can try to create a sample project without using my server logic (Firestore in my case) to receive the data. I am also using Typescript with Composition API and reactive, but I do not think this is an issue. |
@Sun3 Using Please note that the return type of |
@dm4t2 Yep, I previously tried the watcher version, but same results. By the way I really do like you currency control. |
@dm4t2 I was testing further and I noticed that the watch setValue is not being called in the CurrencyInput control. Not sure if I am doing something wrong.
This is my CurrencyInput control code:
The entry form uses the CurrencyInput control in this manner:
|
There's an error in docs for the Vue 3 example 🤔 Should be:
|
@dm4t2 Yep, that works perfectly. Thank you so much, I really appreciate it. |
Is there a way to hide the Currency Symbol with the Vue 3 2.0.0-beta.2? I some scenarios where I need to show the currency symbol and other cases it needs to format the numbers but without the symbol (on the same entry page). Thanks. |
@Sun3 No, see #177 (comment) |
Another pre-release 2.0.0-beta.3 is available for testing. |
I tested 2.0.0-beta.3 and so far working great. |
How can i initialize currency-input on vue3? Documentation is for vue2 version |
@Luigidefra You can find the docs here: https://vue-currency-input-next.netlify.app |
I am running into an issue with using Error while resolving:
By running
Thank you. |
ps: I just uninstalled the following from my computer and reinstalled and it looks like its working again. Does anyone else have this issue that happened to them buy running the latest version of vue '''npm install vue@next``` Uninstall Vue Uninstall npm Uninstall node Reinstalled I will give an update if the issue happens again. |
I have the same trouble too. It seems to be a peerDependency problem. It seems @vue/composition-api@"^1.0.0-rc.1" should not be peerDependency but dependency instead... |
I am still having the same issue, I received a notice for the new npm update to version 7.6.3 and as soon as I updated I am receiving the same errors:
Any thoughts on how to solve this issue with |
@Sun3 @ysinsane npm 7 should work now in 2.0.0-rc.2 🎉 See also vueuse/vue-demi#37 |
Thank you, that worked great. |
Created an empty (well, helloworld) vue 3 project. npm --version vue --version vue create vue-currency-input-test -> compiled, runs -> hello world in browser using npn run serve then: added: to main.js:
compiles, but in browser result in following javascript exception:
reproduced on another PC, same result. |
@itsChris The plugin installation has been dropped in v2. See https://github.com/dm4t2/vue-currency-input/releases/tag/2.0.0-beta.0 |
I just upgraded to npm version 7.80 and I am receiving the following errors that were not there with the previous version of npm. I believe if a number is Error:
The file
Full Error from console:
Any thoughts? |
ps: I created a new record to test that has number values of 0 and above and I am receiving the same error. |
@Sun3 Do you use 2.0.0-rc.4 with a precision range? Please note the breaking change. |
I am using 2.0.0-rc.2 but I just tested with 2.0.0-rc.4 with the same results. Not really sure what happened since it was all working last night, but today I received a notice to update my npm. |
@dm4t2 Does this mean with the precision range removal, you now specify the number of decimals without the option of not showing it if the user does not type in a decimal? This is a huge feature for my project. If the user types in decimal we show it but if they don't we do not show it. Example 1 User types in 14,000 and it shows as 14,000 Would it still work the same as above? ps: I am testing with 2.0.0-rc.4 and just removed the precision range and the error is gone. |
Decimal digits will now be hidden for integer numbers by default, see #203. |
That's great, thank you so much. |
I will close this for now. Please open new issues if there are bugs or you have feedback regarding v2. Thanks! |
Why cannot remove currency from input on vue3 version? tried to pass |
I am going to create a new ticket but I just wanted to note it here too. I was trying to make it work, but it seems there is no way to have a user enter 125,000 or 125,000.44 and declare the precision. You either need to enter precision: 0 or precision: 2. In my case I really need to make the Is there any way to allow the user to enter a currency and only if the user types in the . (period), then use the precision? Thank you. |
Yesterday the final version Vue 3 was launched. But
vue-currency-input
is not compatible.So I had to write some code in one personal project that redefines the plugin, component, and directive to be allowed to be used with Vue 3.
Plugin
In the old version, the
$ci
is defined inVue.prototype.$ci
. The new version we should define this ininstance.config.globalProperties.$ci
to inject the$ci
variables in the instance and make this available globally. And use the redefined directive and component too.The new plugin was defined in this way:
Directive
In the old version, the directive hooks are
bind
andcomponentUpdated
. In the new version, the directive hooks were renamed tobeforeMount
andupdated
. So we can only rename these hooks and everything will work properly, or just wrap the old directive functions in the new directive like this:Component
The component requires most of the changes.
In the old version, the
h
function is injected in therender
function as the first param. In the new version, we should import theh
function from thevue
package, usingimport { h } from 'vue'
. The way that the events are defined is different too. And we don't have the directive property anymore.We doesn't have the
directives
property, so we have to initialize theNumberInput
in themounted
hook, like:And as the props and events for
v-model
was changed. We should use themodelValue
insteadvalue
, and emit'update:modelValue'
instead'input'
.The final version of the file is this:
Final Words
I think making the project compatible with Vue 3 is important, but we have these breaking changes. It would be great if we could have the Vue 3 compatible version of this library.
I hope that what I showed here helps us to have the compatible version, or helps anyone who wants to use this library with Vue 3.
The text was updated successfully, but these errors were encountered: