Skip to content

Fix vite build issue with import from accounting-js #124

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

Merged
merged 2 commits into from
Jun 11, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions src/vue-numeric.vue
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
</template>

<script>
import accounting from 'accounting-js'
import { unformat, formatMoney, toFixed } from 'accounting-js'

export default {
name: 'VueNumeric',
Expand Down Expand Up @@ -325,7 +325,7 @@ export default {
if(typeof this.valueNumber === 'string' && this.valueNumber === '') {
return ''
} else {
this.amount = accounting.formatMoney(this.valueNumber, {
this.amount = formatMoney(this.valueNumber, {
symbol: '',
format: '%v',
thousand: '',
Expand Down Expand Up @@ -361,7 +361,7 @@ export default {
* @param {Number} value
*/
update (value) {
const fixedValue = accounting.toFixed(value, this.precision)
const fixedValue = toFixed(value, this.precision)
const output = this.outputType.toLowerCase() === 'string' ? fixedValue : Number(fixedValue)
this.$emit('input', output)
},
Expand All @@ -373,7 +373,7 @@ export default {
*/
format (value) {
if(typeof value === 'string' && value === '') return ''
return accounting.formatMoney(value, {
return formatMoney(value, {
symbol: this.currency,
format: this.symbolPosition,
precision: Number(this.precision),
Expand All @@ -390,7 +390,7 @@ export default {
unformat (value) {
const toUnformat = typeof value === 'string' && value === '' ? this.emptyValue : value
if(typeof toUnformat === 'string' && toUnformat === '') return ''
return accounting.unformat(toUnformat, this.decimalSeparatorSymbol)
return unformat(toUnformat, this.decimalSeparatorSymbol)
},

/**
Expand Down