vue-numeric
vue-numeric copied to clipboard
Support for Vue 3 and Typescript
Hi, I'm working on a project that uses Vue 3 and Typescript. I was wondering if you could include a type declaration module (.d.ts file) in the package. I'd be glad to help but I'm kinda a novice in this.
Could not find a declaration file for module 'vue-numeric'. '[redacted]/node_modules/vue-numeric/dist/vue-numeric.min.js' implicitly has an 'any' type.
Try `npm i --save-dev @types/vue-numeric` if it exists or add a new declaration (.d.ts) file containing `declare module 'vue-numeric';`ts(7016)
Just created a small module declaration. Surely not the best...
vue-numeric.d.ts
declare module "vue-numeric" {
import Vue from "vue";
interface VueNumeric extends Vue, HTMLInputElement {
props: {
currency: string; // Currency prefix
currencySymbolPosition: string; // Position of the symbol (accepted values: prefix or suffix)
decimalSeparator: string; // Custom decimal separator
emptyValue: number; // Value when input is empty
max: number; // Maximum value allowed
min: number; // Minimum value allowed
minus: boolean; // Enable/disable negative values
outputType: string; // Output Type for input event
placeholder: string; // Input placeholder
precision: number; // Number of decimals
readOnly: boolean; // Hide input field and show the value as text
readOnlyClass: string; // Class for read-only element
separator: string; // Thousand separator symbol (accepts space, . or ,)
thousandSeparator: string; // Custom thousand separator
};
}
}
Hi Kevin, Are you going to do a Vue3 version? I have test the one mentioned but it is not working.
thank you
I rewrote this component for my needs in TS and for Vue3, maybe it suits your needs to? https://github.com/robinrossow/vue-input-number