@coders-tm/vue-number-format
Advanced tools
Comparing version 1.0.5 to 1.0.6
{ | ||
"name": "@coders-tm/vue-number-format", | ||
"version": "1.0.5", | ||
"version": "1.0.6", | ||
"private": false, | ||
@@ -27,5 +27,5 @@ "description": "Easy formatted numbers, currency and percentage with input/directive mask for Vue.js", | ||
"@babel/preset-env": "^7.9.5", | ||
"@shopify/jest-dom-mocks": "^2.8.11", | ||
"@vue/cli-plugin-unit-jest": "^4.5.13", | ||
"@vue/test-utils": "^1.0.0-beta.33", | ||
"@vue/cli-service": "^4.5.13", | ||
"@vue/test-utils": "^1.2.2", | ||
"@vuedoc/md": "^1.6.0", | ||
@@ -35,3 +35,3 @@ "@vuepress/plugin-back-to-top": "^1.8.2", | ||
"@vuepress/plugin-register-components": "^1.4.1", | ||
"babel-core": "^7.0.0-bridge.0", | ||
"babel-core": "^6.26.3", | ||
"babel-jest": "^25.3.0", | ||
@@ -47,2 +47,3 @@ "babel-preset-env": "^1.7.0", | ||
"npm-run-all": "^4.1.5", | ||
"postcss": "6.0", | ||
"quasar": "^1.11.3", | ||
@@ -61,3 +62,3 @@ "rollup": "^2.6.1", | ||
"vue-template-compiler": "^2.6.11", | ||
"vuepress": "^1.4.1", | ||
"vuepress": "^1.8.2", | ||
"vuepress-plugin-demo-code": "^0.5.0" | ||
@@ -64,0 +65,0 @@ }, |
# vue-number-format | ||
Vue Number Format is used to format a number using fixed-point notation. It can be used to format a number with a specific number of digits to the right of the decimal. | ||
## Features | ||
@@ -12,93 +12,4 @@ | ||
## Demo | ||
[https://coders-tm.github.io/vue-number-format/](https://coders-tm.github.io/vue-number-format/) | ||
## Usage | ||
## Documentation | ||
Please refer to the [project home page](https://coders-tm.github.io/vue-number-format/) for a detailed documentation. | ||
### A. Globally | ||
```js | ||
import Vue from 'vue' | ||
import number from 'vue-number-format' | ||
// register directive v-number and component <number> | ||
Vue.use(number, {precision: 4}) | ||
``` | ||
### B. Use as component | ||
```html | ||
<template> | ||
<div> | ||
<number v-model="price" v-bind="number"></number> {{price}} | ||
</div> | ||
</template> | ||
<script> | ||
import { Number } from 'vue-number-format' | ||
export default { | ||
components: { | ||
Number | ||
}, | ||
data () { | ||
return { | ||
price: 123.45, | ||
number: { | ||
decimal: '.', | ||
separator: ',', | ||
prefix: '$ ', | ||
suffix: ' #', | ||
precision: 2, | ||
masked: false | ||
} | ||
} | ||
} | ||
} | ||
</script> | ||
``` | ||
### C. Use as directive | ||
Must use `vmodel.lazy` to bind works properly. | ||
```html | ||
<template> | ||
<div> | ||
<input v-model.lazy="price" v-number="number" /> {{price}} | ||
</div> | ||
</template> | ||
<script> | ||
import { VNumber } from 'vue-number-format' | ||
export default { | ||
data () { | ||
return { | ||
price: 123.45, | ||
number: { | ||
decimal: '.', | ||
separator: ',', | ||
prefix: '$ ', | ||
suffix: ' #', | ||
precision: 2, | ||
masked: false /* doesn't work with directive */ | ||
} | ||
} | ||
}, | ||
directives: { | ||
number: VNumber | ||
} | ||
} | ||
</script> | ||
``` | ||
## Properties | ||
| property | Required | Type | Default | Description | | ||
|-----------|----------|---------|---------|---------------------------------------------------------| | ||
| precision | false | Number | 2 | How many decimal places | | ||
| decimal | false | String | "." | Decimal separator | | ||
| separator | false | String | "," | Thousands separator | | ||
| prefix | false | String | "" | Currency symbol followed by a Space, like "$ " | | ||
| suffix | false | String | "" | Percentage for example: " %" | | ||
| masked | false | Boolean | false | If the component output should include the mask or not | |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
0
75270
36
15